Example #1
0
 protected function processActions(SwatTableView $view, SwatActions $actions)
 {
     $num = count($view->getSelection());
     $message = null;
     switch ($actions->selected->id) {
         case 'delete':
             $this->app->replacePage('MetaData/Delete');
             $this->app->getPage()->setItems($view->checked_items);
             break;
         case 'show_details':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:visible', true, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One detail has been enabled.', '%s details have been enabled.', $num), SwatString::numberFormat($num)));
             break;
         case 'dont_show_details':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:visible', false, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One detail has been disabled.', '%s details have been disabled.', $num), SwatString::numberFormat($num)));
             break;
         case 'show_machine':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:machine_tag', true, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One machine tag has been enabled.', '%s machine tags have been enabled.', $num), SwatString::numberFormat($num)));
             break;
         case 'dont_show_machine':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:machine_tag', false, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One machine tag has been disabled.', '%s machine tags have been disabled.', $num), SwatString::numberFormat($num)));
             break;
     }
     if ($message !== null) {
         $this->app->messages->add($message);
     }
 }
Example #2
0
    protected function saveIndex($id, $index)
    {
        SwatDB::updateColumn($this->app->db, 'BlorgAuthor', 'integer:displayorder', $index, 'integer:id', array($id));
        $instance_id = $this->app->getInstanceId();
        $sql = sprintf('update BlorgAuthor set displayorder = %s
			where id = %s and instance %s %s', $this->app->db->quote($index, 'integer'), $this->app->db->quote($id, 'integer'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        SwatDB::exec($this->app->db, $sql);
        if (isset($this->app->memcache)) {
            $this->app->memcache->flushNs('authors');
        }
    }
Example #3
0
 /**
  * Processes photographer actions
  *
  * @param SwatTableView $view the table-view to get selected photographers
  *                             from.
  * @param SwatActions $actions the actions list widget.
  */
 protected function processActions(SwatTableView $view, SwatActions $actions)
 {
     switch ($actions->selected->id) {
         case 'delete':
             $this->app->replacePage('Photographer/Delete');
             $this->app->getPage()->setItems($view->checked_items);
             break;
         case 'status_action':
             $num = count($view->checked_items);
             $status = $this->ui->getWidget('status_flydown')->value;
             SwatDB::updateColumn($this->app->db, 'PinholePhotographer', 'integer:status', $status, 'id', $view->checked_items);
             $message = new SwatMessage(sprintf(Pinhole::ngettext('The status of one photographer has been changed.', 'The status of %s photographers has been changed.', $num), SwatString::numberFormat($num)));
             $this->app->messages->add($message);
             break;
     }
 }
Example #4
0
 protected function saveIndex($id, $index)
 {
     SwatDB::updateColumn($this->app->db, 'Block', 'integer:displayorder', $index, 'integer:id', array($id));
 }