Skip to content

Commit

Permalink
Ajout des actus dans l'app admin
Browse files Browse the repository at this point in the history
  • Loading branch information
pocky committed Jun 4, 2011
1 parent d6c6562 commit 998e582
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 2 deletions.
24 changes: 24 additions & 0 deletions apps/admin/i18n/messages.fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,30 @@
<source>Your meta language</source>
<target>La langue de votre site</target>
</trans-unit>
<trans-unit>
<source>Published actualities</source>
<target>Articles publiés</target>
</trans-unit>
<trans-unit>
<source>Last actualities</source>
<target>Les dernières actualités</target>
</trans-unit>
<trans-unit>
<source>Actualities settings</source>
<target>Gestion des actualités</target>
</trans-unit>
<trans-unit>
<source>Max last items</source>
<target>Nombre d'actualités affichées</target>
</trans-unit>
<trans-unit>
<source>Max actu per page</source>
<target>Nombre d'actualités par page</target>
</trans-unit>
<trans-unit>
<source>This is your actualities settings, they are used for the frontend application.</source>
<target>Voici les paramètres de gestion de vos actualités, ils sont utilisés pour l'affiche du site publique.</target>
</trans-unit>
</body>
</file>
</xliff>
9 changes: 9 additions & 0 deletions apps/admin/modules/dashboard/actions/components.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function executeCount(sfWebRequest $request)

$users = Doctrine_Core::getTable('sfGuardUser')->getUsers();
$this->users = $users->fetchArray();

$actus = Doctrine_Core::getTable('peanutActu')->getActus();
$this->actus = $actus->fetchArray();
}

public function executeUsers(sfWebRequest $request)
Expand Down Expand Up @@ -73,5 +76,11 @@ public function executeFeed(sfWebRequest $request)

}

public function executeActus(sfWebRequest $request)
{
$actus = Doctrine_Core::getTable('peanutActu')->getLastActus(5);
$this->actus = $actus->execute();
}


}
20 changes: 20 additions & 0 deletions apps/admin/modules/dashboard/templates/_actus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<section id="items" class="box">
<header>
<h2><?php echo __('Last actualities') ?></h2>
</header>

<section class="boxContent">
<table>
<tbody>
<?php foreach($actus as $actu): ?>
<tr>
<td class="item"><?php echo $actu->getTitle() ?></td>
<td class="action"><a href="<?php echo url_for('peanut_actu_edit', array('id' => $actu->getId())) ?>"><?php echo __('Edit') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

</section>

</section>
4 changes: 4 additions & 0 deletions apps/admin/modules/dashboard/templates/_count.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<p><span><?php echo count($items) ?></span> <?php echo __('Published items') ?></p>
</section>

<section class="box item">
<p><span><?php echo count($actus) ?></span> <?php echo __('Published actualities') ?></p>
</section>

</section>
1 change: 1 addition & 0 deletions apps/admin/modules/dashboard/templates/indexSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<?php include_component('dashboard', 'users') ?>
<?php include_component('dashboard', 'items') ?>
<?php include_component('dashboard', 'actus') ?>
<?php include_component('dashboard', 'analytics') ?>
<?php include_component('dashboard', 'feed') ?>

Expand Down
20 changes: 20 additions & 0 deletions apps/admin/modules/settings/lib/BaseSettingsActions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,24 @@ public function executeGeneral(sfWebRequest $request)

}
}

public function executeActu(sfWebRequest $request)
{
$this->form = new actuSettingsForm();

if($request->isMethod('post'))
{
$this->form->bind($request->getParameter('settings'));

if($this->form->isValid())
{

foreach($this->form->getValues() as $name => $value)
{
peanutConfig::set($name, $value);
}

}
}
}
}
3 changes: 3 additions & 0 deletions apps/admin/modules/settings/templates/_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
<li>
<a href="<?php echo url_for('settings', array('action' => 'seo')); ?>" title="<?php echo __('Link to', null, 'peanutCorporate') ?>"><?php echo __('Your SEO'); ?></a>
</li>
<li>
<a href="<?php echo url_for('settings', array('action' => 'actu')); ?>" title="<?php echo __('Link to', null, 'peanutCorporate') ?>"><?php echo __('Actualities settings'); ?></a>
</li>
</ul>
</nav>
58 changes: 58 additions & 0 deletions apps/admin/modules/settings/templates/actuSuccess.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<section id="sf_admin_container">

<header>
<h1><?php echo __('Actualities settings') ?></h1>
</header>

<section id="sf_admin_header"></section>

<section id="sf_admin_content">

<div class="sf_admin_form clearfix">
<form action="<?php echo url_for('settings/actu') ?>" method="post">

<?php echo $form->renderHiddenFields() ?>
<fieldset id="sf_fieldset_content">

<div class="content_box_content clearfix">

<div class="sf_admin_form_row sf_admin_text sf_admin_form_field_site_name">
<div>
<?php echo $form['actu_max_last']->renderLabel() ?>
<div class="content">
<?php echo $form['actu_max_last']->render(array('class' => 'text-input')) ?>
</div>
<div class="help">

</div>
</div>
</div>

<div class="sf_admin_form_row sf_admin_text sf_admin_form_field_meteo">
<div>
<?php echo $form['actu_per_page']->renderLabel() ?>
<div class="content">
<?php echo $form['actu_per_page']->render(array('class' => 'text-input')) ?>
</div>
<div class="help">

</div>
</div>
</div>

</div>

</fieldset>

<fieldset id="sf_fieldset_informations">

<p><?php echo __('This is your actualities settings, they are used for the frontend application.') ?></p>

<input name="Send" type="submit" value="<?php echo __('Submit') ?>" class="button" id="send" size="16"/>
</fieldset>

</form>
</div>
</section>

</section>
2 changes: 1 addition & 1 deletion apps/www/config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ all:

# Enable the database manager
use_database: true
enabled_modules: [items, contact, sitemap]
enabled_modules: [items, contact, sitemap, actu]

i18n: on
default_culture: fr_FR
Expand Down
2 changes: 1 addition & 1 deletion data/sql/schema.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE peanut_actu (id BIGINT AUTO_INCREMENT, title VARCHAR(255) NOT NULL, content LONGTEXT, excerpt LONGTEXT, author BIGINT NOT NULL, status VARCHAR(255) DEFAULT 'draft', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), position BIGINT, seo_id BIGINT, UNIQUE INDEX peanut_actu_sluggable_idx (slug), UNIQUE INDEX peanut_actu_position_sortable_idx (position), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE peanut_actu (id BIGINT AUTO_INCREMENT, title VARCHAR(255) NOT NULL, content LONGTEXT, excerpt LONGTEXT, author BIGINT NOT NULL, status VARCHAR(255) DEFAULT 'draft', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), seo_id BIGINT, UNIQUE INDEX peanut_actu_sluggable_idx (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE peanut_item (id BIGINT AUTO_INCREMENT, type VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT, menu BIGINT NOT NULL, author BIGINT NOT NULL, status VARCHAR(255) DEFAULT 'draft', excerpt LONGTEXT, url VARCHAR(255), relation BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), position BIGINT, seo_id BIGINT, INDEX peanut_item_type_idx (type), UNIQUE INDEX peanut_item_sluggable_idx (slug), UNIQUE INDEX peanut_item_position_sortable_idx (position, menu), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE peanut_item (id BIGINT AUTO_INCREMENT, type VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT, menu BIGINT NOT NULL, author BIGINT NOT NULL, status VARCHAR(255) DEFAULT 'draft', excerpt LONGTEXT, url VARCHAR(255), relation BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), position BIGINT, seo_id BIGINT, UNIQUE INDEX peanut_item_sluggable_idx (slug), UNIQUE INDEX peanut_item_position_sortable_idx (position, menu), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE peanut_menu (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, slug VARCHAR(255), root_id BIGINT, lft INT, rgt INT, level SMALLINT, UNIQUE INDEX peanut_menu_sluggable_idx (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
Expand Down

0 comments on commit 998e582

Please sign in to comment.