示例#1
0
 public function configure()
 {
     $this->widgetSchema['active'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->setDefault('active', 1);
     $this->widgetSchema['default_value'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->setDefault('default_value', 0);
     $this->widgetSchema['group'] = new sfWidgetFormChoice(array('choices' => app::getStatusGroupsChoices()));
     $this->widgetSchema['name']->setAttribute('class', 'required');
     $this->widgetSchema['sort_order']->setAttribute('size', '3');
     $this->widgetSchema->setLabels(array('status_group' => 'Group', 'sort_order' => 'Sort Order', 'default_value' => 'Default?', 'background_color' => 'Background', 'active' => 'Active?'));
 }
示例#2
0
 public function executeSortGroupedItemsProcess(sfWebRequest $request)
 {
     $t = $request->getParameter('t');
     foreach (app::getStatusGroupsChoices() as $k => $name) {
         $sort_order = 0;
         foreach (explode(',', $request->getParameter('sorted_items_' . $k)) as $fields_id) {
             if ($t == 'tasksStatus') {
                 $t = 'tasks_status';
             }
             if ($t == 'ticketsStatus') {
                 $t = 'tickets_status';
             }
             $sql = "update " . $t . " ts set ts.group='" . $k . "', ts.sort_order='" . $sort_order . "' where ts.id='" . str_replace('field_', '', $fields_id) . "'";
             $connection = Doctrine_Manager::connection();
             $connection->execute($sql);
             $sort_order++;
         }
     }
     exit;
 }
示例#3
0
<h1><?php 
echo __('Sort Items');
?>
</h1>

<?php 
echo __('Just move an item up or down.');
?>
<br>
<?php 
foreach (app::getStatusGroupsChoices() as $k => $name) {
    echo '<b>' . $name . '</b>';
    ?>

<ul id="sorted_items_<?php 
    echo $k;
    ?>
" class='droptrue'>
  <?php 
    foreach ($itmes as $v) {
        if ($v->getGroup() == $k) {
            echo '<li id="field_' . $v->getId() . '">' . $v->getName() . '</li>';
        }
    }
    ?>
</ul>
<?php 
}
?>

<?php