Beispiel #1
0
    /**
     * Processes photographer actions
     *
     * @param SwatTableView $view the table-view to get selected tags
     *                             from.
     * @param SwatActions $actions the actions list widget.
     */
    protected function processActions(SwatTableView $view, SwatActions $actions)
    {
        switch ($actions->selected->id) {
            case 'delete':
                $this->app->replacePage($this->getComponentName() . '/Delete');
                $this->app->getPage()->setItems($view->checked_items, $view->getColumn('checkbox')->isExtendedCheckAllSelected());
                break;
            case 'archive':
                $num = count($view->checked_items);
                $sql = sprintf('update PinholeTag set archived = true
				where PinholeTag.instance = %s and PinholeTag.id in(%s)', $this->app->db->quote($this->app->getInstanceId(), 'integer'), SwatDB::implodeSelection($this->app->db, $view->getSelection()));
                SwatDB::exec($this->app->db, $sql);
                $message = new SwatMessage(sprintf(Pinhole::ngettext('One tag has been archived.', '%s tags have been archived.', $num), SwatString::numberFormat($num)));
                $this->app->messages->add($message);
                break;
            case 'unarchive':
                $num = count($view->checked_items);
                $sql = sprintf('update PinholeTag set archived = false
				where PinholeTag.instance = %s and PinholeTag.id in(%s)', $this->app->db->quote($this->app->getInstanceId(), 'integer'), SwatDB::implodeSelection($this->app->db, $view->getSelection()));
                SwatDB::exec($this->app->db, $sql);
                $message = new SwatMessage(sprintf(Pinhole::ngettext('One tag has been set as not archived.', '%s tags have been set as not archived.', $num), SwatString::numberFormat($num)));
                $this->app->messages->add($message);
                break;
            case 'event':
                $num = count($view->checked_items);
                $sql = sprintf('update PinholeTag set event = true
				where PinholeTag.instance = %s and PinholeTag.id in(%s)', $this->app->db->quote($this->app->getInstanceId(), 'integer'), SwatDB::implodeSelection($this->app->db, $view->getSelection()));
                SwatDB::exec($this->app->db, $sql);
                $message = new SwatMessage(sprintf(Pinhole::ngettext('One tag has been set as an event.', '%s tags have been set as events.', $num), SwatString::numberFormat($num)));
                $this->app->messages->add($message);
                break;
            case 'unevent':
                $num = count($view->checked_items);
                $sql = sprintf('update PinholeTag set event = false
				where PinholeTag.instance = %s and PinholeTag.id in(%s)', $this->app->db->quote($this->app->getInstanceId(), 'integer'), SwatDB::implodeSelection($this->app->db, $view->getSelection()));
                SwatDB::exec($this->app->db, $sql);
                $message = new SwatMessage(sprintf(Pinhole::ngettext('One tag has been set as not an event.', '%s tags have been set as not events.', $num), SwatString::numberFormat($num)));
                $this->app->messages->add($message);
                break;
        }
    }