Exemple #1
0
    protected function processDBData()
    {
        parent::processDBData();
        $item_list = $this->getItemList('integer');
        $instance_id = $this->app->getInstanceId();
        // delete attached files using their dataobjects to remove the actual
        // files
        $sql = sprintf('select * from BlorgFile
			inner join BlorgPost on BlorgPost.id = BlorgFile.post
			where BlorgPost.instance %s %s and BlorgFile.post in (%s)', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
        $files = SwatDB::query($this->app->db, $sql, SwatDBClassMap::get('BlorgFileWrapper'));
        foreach ($files as $file) {
            $file->setFileBase('../');
            $file->delete();
        }
        // delete the posts
        $sql = sprintf('delete from BlorgPost
			where instance %s %s and id in (%s)', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
        $num = SwatDB::exec($this->app->db, $sql);
        if (isset($this->app->memcache)) {
            $this->app->memcache->flushNS('posts');
        }
        $message = new SwatMessage(sprintf(Blorg::ngettext('One post has been deleted.', '%s posts have been deleted.', $num), SwatString::numberFormat($num)));
        $this->app->messages->add($message);
    }
Exemple #2
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);
     }
 }
Exemple #3
0
    public function processActions(SwatTableView $view, SwatActions $actions)
    {
        $num = count($view->getSelection());
        $message = null;
        $items = SwatDB::implodeSelection($this->app->db, $view->getSelection(), 'integer');
        switch ($actions->selected->id) {
            case 'delete':
                $this->app->replacePage($this->getComponentName() . '/Delete');
                $this->app->getPage()->setItems($view->getSelection());
                break;
            case 'enable':
                $instance_id = $this->app->getInstanceId();
                $num = SwatDB::exec($this->app->db, sprintf('update BlorgAuthor set visible = %s
				where instance %s %s and id in (%s)', $this->app->db->quote(true, 'boolean'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $items));
                if ($num > 0 && isset($this->app->memcache)) {
                    $this->app->memcache->flushNs('authors');
                }
                $message = new SwatMessage(sprintf(Blorg::ngettext('One author has been shown on site.', '%s authors have been shown on site.', $num), SwatString::numberFormat($num)));
                break;
            case 'disable':
                $instance_id = $this->app->getInstanceId();
                $num = SwatDB::exec($this->app->db, sprintf('update BlorgAuthor set visible = %s
				where instance %s %s and id in (%s)', $this->app->db->quote(false, 'boolean'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $items));
                if ($num > 0 && isset($this->app->memcache)) {
                    $this->app->memcache->flushNs('authors');
                }
                $message = new SwatMessage(sprintf(Blorg::ngettext('One author has been hidden on site.', '%s authors have been hidden on site.', $num), SwatString::numberFormat($num)));
                break;
        }
        if ($message !== null) {
            $this->app->messages->add($message);
        }
    }
Exemple #4
0
    protected function processDBData()
    {
        parent::processDBData();
        $instance_id = $this->app->getInstanceId();
        $sql = 'delete from PinholePhotographer where id in (%s)
			and instance %s %s';
        $item_list = $this->getItemList('integer');
        $sql = sprintf($sql, $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        $num = SwatDB::exec($this->app->db, $sql);
        $message = new SwatMessage(sprintf(Pinhole::ngettext('One photographer has been deleted.', '%s photographers have been deleted.', $num), SwatString::numberFormat($num)));
        $this->app->messages->add($message);
    }
 public function display()
 {
     if (!$this->visible) {
         return;
     }
     if ($this->tag_list === null) {
         return;
     }
     if ($this->sub_tag_list === null || count($this->sub_tag_list) == 0) {
         return;
     }
     parent::display();
     $div_tag = new SwatHtmlTag('div');
     $div_tag->class = 'pinhole-sub-tag-list-view';
     $div_tag->id = $this->id;
     $div_tag->open();
     if (count($this->tag_list) > 0) {
         $titles = array();
         foreach ($this->tag_list as $tag) {
             $titles[] = $tag->getTitle();
         }
         $header_tag = new SwatHtmlTag('h2');
         $header_tag->setContent(sprintf(Pinhole::_('View photos tagged “%s” and:'), implode('”, “', $titles)));
         $header_tag->display();
     } elseif ($this->title !== null) {
         $header_tag = new SwatHtmlTag('h2');
         $header_tag->setContent($this->title);
         $header_tag->display();
     }
     $ul_tag = new SwatHtmlTag('ul');
     $ul_tag->id = $this->id . '_list';
     $ul_tag->open();
     $li_tag = new SwatHtmlTag('li');
     foreach ($this->sub_tag_list as $tag) {
         $add_list = clone $this->tag_list;
         $add_list->add($tag);
         $li_tag->open();
         $add_anchor_tag = new SwatHtmlTag('a');
         $add_anchor_tag->class = 'pinhole-tag-list-view-tag';
         $add_anchor_tag->rel = 'tag';
         $add_anchor_tag->href = $this->base . '?' . $add_list->__toString();
         $add_anchor_tag->setContent($tag->getTitle());
         if ($tag->photo_count !== null) {
             $add_anchor_tag->title = sprintf('%s %s', SwatString::minimizeEntities(SwatString::numberFormat($tag->photo_count)), SwatString::minimizeEntities(Pinhole::ngettext('Photo', 'Photos', $tag->photo_count)));
         }
         $add_anchor_tag->display();
         $li_tag->close();
         unset($add_list);
     }
     $ul_tag->close();
     $div_tag->close();
 }
Exemple #6
0
 protected function processDBData()
 {
     parent::processDBData();
     $item_list = $this->getItemList('integer');
     $sql = sprintf('delete from BlorgTag where id in (%s)', $item_list);
     $num = SwatDB::exec($this->app->db, $sql);
     if (isset($this->app->memcache)) {
         $this->app->memcache->flushNs('tags');
         $this->app->memcache->flushNs('posts');
     }
     $message = new SwatMessage(sprintf(Blorg::ngettext('One tag has been deleted.', '%s tags have been deleted.', $num), SwatString::numberFormat($num)));
     $this->app->messages->add($message);
 }
Exemple #7
0
    protected function processDBData()
    {
        AdminDBDelete::processDBData();
        $instance_id = $this->app->getInstanceId();
        $sql = sprintf('select parent from Article
			where id = %s and instance %s %s', $this->app->db->quote($this->getFirstItem(), 'integer'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        $this->parent_id = SwatDB::queryOne($this->app->db, $sql);
        $item_list = $this->getItemList('integer');
        $sql = sprintf('delete from Article
			where id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        $num = SwatDB::exec($this->app->db, $sql);
        $message = new SwatMessage(sprintf(Site::ngettext('One article has been deleted.', '%s articles have been deleted.', $num), SwatString::numberFormat($num)));
        $this->app->messages->add($message);
    }
Exemple #8
0
 protected function processDBData()
 {
     parent::processDBData();
     if ($this->ui->getWidget('photo_time_zone')->value !== null && $this->ui->getWidget('camera_time_zone')->value !== null) {
         $num = $this->adjustTimeZone();
     } else {
         $num = $this->addDateParts();
     }
     $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been updated.', '%s photos have been updated.', $num), SwatString::numberFormat($num)));
     $this->app->messages->add($message);
     if (isset($this->app->memcache)) {
         $this->app->memcache->flushNs('photos');
     }
 }
Exemple #9
0
 protected function processDBData()
 {
     parent::processDBData();
     $photos = $this->getPhotos();
     $num = count($photos);
     foreach ($photos as $photo) {
         $photo->setFileBase('../../photos');
         $photo->delete();
     }
     $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been deleted.', '%s photos have been deleted.', $num), SwatString::numberFormat($num)));
     $this->app->messages->add($message);
     if (isset($this->app->memcache)) {
         $this->app->memcache->flushNs('photos');
     }
 }
Exemple #10
0
    protected function processDBData()
    {
        parent::processDBData();
        $item_list = $this->getItemList('integer');
        $instance_id = $this->app->getInstanceId();
        $sql = sprintf('delete from BlorgAuthor where id in (%s)
			and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
        $num = SwatDB::exec($this->app->db, $sql);
        if (isset($this->app->memcache)) {
            $this->app->memcache->flushNs('authors');
            $this->app->memcache->flushNs('posts');
        }
        $message = new SwatMessage(sprintf(Blorg::ngettext('One author has been deleted.', '%s authors have been deleted.', $num), SwatString::numberFormat($num)));
        $this->app->messages->add($message);
    }
Exemple #11
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;
     }
 }
Exemple #12
0
 protected function processDBData()
 {
     parent::processDBData();
     $sql = 'delete from PinholeTag where instance %s %s';
     $item_list = $this->getItemList('integer');
     $instance_id = $this->app->getInstanceId();
     $sql = sprintf($sql, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
     if (!$this->extended_selected) {
         $sql .= sprintf(' and id in (%s)', $item_list);
     }
     $num = SwatDB::exec($this->app->db, $sql);
     if (isset($this->app->memcache)) {
         $this->app->memcache->flushNs('photos');
     }
     $message = new SwatMessage(sprintf(Pinhole::ngettext('One tag has been deleted.', '%s tags have been deleted.', $num), SwatString::numberFormat($num)));
     $this->app->messages->add($message);
 }
Exemple #13
0
    protected function processDBData()
    {
        parent::processDBData();
        $item_list = $this->getItemList('integer');
        $instance_id = $this->app->getInstanceId();
        $this->addToSearchQueue($item_list);
        $sql = sprintf('delete from BlorgComment
			where id in
				(select BlorgComment.id from BlorgComment
					inner join BlorgPost on BlorgPost.id = BlorgComment.post
				where instance %s %s and BlorgComment.id in (%s))', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
        $num = SwatDB::exec($this->app->db, $sql);
        if (isset($this->app->memcache)) {
            $this->app->memcache->flushNS('posts');
        }
        $message = new SwatMessage(sprintf(Blorg::ngettext('One comment has been deleted.', '%s comments have been deleted.', $num), SwatString::numberFormat($num)));
        $this->app->messages->add($message);
    }
Exemple #14
0
    protected function publishPosts(SwatViewSelection $post_ids)
    {
        $num = 0;
        $transaction = new SwatDBTransaction($this->app->db);
        try {
            $instance_id = $this->app->getInstanceId();
            $post_ids = SwatDB::implodeSelection($this->app->db, $post_ids);
            $sql = sprintf('select id, shortname, title, bodytext from BlorgPost
				where instance %s %s and id in (%s) and enabled = %s', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $post_ids, $this->app->db->quote(false, 'boolean'));
            $posts = SwatDB::query($this->app->db, $sql, SwatDBClassMap::get('BlorgPostWrapper'));
            foreach ($posts as $post) {
                if ($post->shortname === null) {
                    $post->shortname = $this->getPostShortname($post);
                }
                $post->enabled = true;
                $post->save();
                $num++;
            }
            $transaction->commit();
        } catch (Exception $e) {
            $transaction->rollback();
            throw $e;
        }
        if ($num > 0 && isset($this->app->memcache)) {
            $this->app->memcache->flushNs('posts');
        }
        $message = new SwatMessage(sprintf(Blorg::ngettext('One post has been shown on site.', '%s posts have been shown on site.', $num), SwatString::numberFormat($num)));
    }
 protected function displayCount()
 {
     // show a count of photos in the tag list
     $photo_count = $this->tag_list->getPhotoCount();
     $span_tag = new SwatHtmlTag('span');
     $span_tag->class = 'photo-count';
     $span_tag->setContent(sprintf(Pinhole::ngettext('(%s Photo)', '(%s Photos)', $photo_count), SwatString::numberFormat($photo_count)));
     $span_tag->display();
 }
 protected function displayTag(PinholeTag $tag)
 {
     $add_list = clone $this->tag_list;
     $add_list->add($tag);
     $add_anchor_tag = new SwatHtmlTag('a');
     $add_anchor_tag->rel = 'tag';
     $add_anchor_tag->href = $this->app->config->pinhole->path . 'tag?' . $add_list->__toString();
     $add_anchor_tag->setContent($tag->getTitle());
     if ($tag->photo_count !== null) {
         $add_anchor_tag->title = sprintf('%s %s', SwatString::minimizeEntities(SwatString::numberFormat($tag->photo_count)), SwatString::minimizeEntities(Pinhole::ngettext('Photo', 'Photos', $tag->photo_count)));
     }
     $add_anchor_tag->display();
 }
 /**
  * Displays date.date tags for all the photos in the site instance of
  * this date tag browser's tag list
  *
  * The <i>$start_date</i> and <i>$end_date</i> are used to tell which
  * day, month and year are currently selected.
  *
  * @param SwatDate $start_date the start date of the photos in this date
  *                              tag browser's tag list.
  * @param SwatDate $end_date the end date of the photos in this date
  *                              tag browser's tag list.
  */
 protected function displayDays(SwatDate $start_date, SwatDate $end_date)
 {
     $date = new SwatDate();
     /*
      * Setting the month and year to the $start_date month and year makes
      * sense because the day list is only displayed if the start year and
      * month are the same as the end year and month.
      */
     $date->setMonth($start_date->getMonth());
     $date->setYear($start_date->getYear());
     // get selected day if it exists
     if ($start_date->getDay() == $end_date->getDay()) {
         $selected_day = $start_date->getDay();
     } else {
         $selected_day = null;
     }
     // create base tag list that new date.month tags will be added to
     $tag_list = $this->tag_list->filter(array('PinholeDateTag'));
     $tag_list->add(sprintf('date.year=%s', $date->formatLikeIntl('yyyy')));
     $tag_list->add(sprintf('date.month=%s', $date->formatLikeIntl('MM')));
     $photos = $tag_list->getPhotoCountByDate('day');
     // Filter again since the day list uses date.date tags instead of
     // combined date.year, date.month and date.day tags.
     $tag_list = $this->tag_list->filter(array('PinholeDateTag'));
     // display date.date tags for each day
     $div_tag = new SwatHtmlTag('div');
     $div_tag->class = 'days clearfix';
     $div_tag->open();
     $days_in_month = $date->getDaysInMonth();
     for ($i = 1; $i <= $days_in_month; $i++) {
         $date->setDay($i);
         $key = $date->formatLikeIntl('yyyy-MM-dd');
         $tag_string = sprintf('date.date=%s', $date->formatLikeIntl('yyyy-MM-dd'));
         $tag_list->add($tag_string);
         if ($selected_day === $i) {
             $span_tag = new SwatHtmlTag('span');
             $span_tag->setContent($date->formatLikeIntl('dd'));
             $span_tag->class = 'selected';
             $span_tag->display();
         } elseif (array_key_exists($key, $photos)) {
             $a_tag = new SwatHtmlTag('a');
             $a_tag->href = $this->base . '?' . $tag_list->__toString();
             $a_tag->title = sprintf(Pinhole::ngettext('1 photo', '%s photos', $photos[$key]), SwatString::numberFormat($photos[$key]));
             $a_tag->setContent($date->formatLikeIntl('dd'));
             $a_tag->display();
         } else {
             $span_tag = new SwatHtmlTag('span');
             $span_tag->setContent($date->formatLikeIntl('dd'));
             $span_tag->display();
         }
         $tag_list->remove($tag_string);
     }
     $div_tag->close();
 }
 /**
  * Processes actions on photos
  *
  * @param SwatTableView $view the view to process.
  * @param SwatActions $actions the list of actions.
  */
 public function process($view, $actions, $ui)
 {
     switch ($actions->selected->id) {
         case 'delete':
             $this->page->app->replacePage('Photo/Delete');
             $this->page->app->getPage()->setItems($view->getSelection(), $view->isExtendedCheckAllSelected());
             break;
         case 'time':
             $this->page->app->replacePage('Photo/Time');
             $this->page->app->getPage()->setItems($view->getSelection(), $view->isExtendedCheckAllSelected());
             break;
         case 'private':
             if ($ui->getWidget('passphrase')->value !== null) {
                 $this->page->app->config->pinhole->passphrase = md5($ui->getWidget('passphrase')->value);
                 $this->page->app->config->save(array('pinhole.passphrase'));
             }
             if ($this->page->app->config->pinhole->passphrase !== null) {
                 $photos = $this->getPhotos($view);
                 $num = count($photos);
                 foreach ($photos as $photo) {
                     $photo->private = true;
                     $photo->save();
                 }
                 if (isset($this->page->app->memcache)) {
                     $this->page->app->memcache->flushNs('photos');
                 }
                 $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been set as private.', '%s photos have been set as private.', $num), SwatString::numberFormat($num)));
                 $this->page->app->messages->add($message);
             }
             break;
         case 'public':
             $photos = $this->getPhotos($view);
             $num = count($photos);
             foreach ($photos as $photo) {
                 $photo->private = true;
                 $photo->save();
             }
             if (isset($this->page->app->memcache)) {
                 $this->page->app->memcache->flushNs('photos');
             }
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been set as public.', '%s photos have been set as public.', $num), SwatString::numberFormat($num)));
             $this->page->app->messages->add($message);
             break;
         case 'for_sale':
         case 'not_for_sale':
             $photos = $this->getPhotos($view);
             $num = count($photos);
             foreach ($photos as $photo) {
                 $photo->for_sale = $actions->selected->id == 'for_sale';
                 $photo->save();
             }
             if (isset($this->page->app->memcache)) {
                 $this->page->app->memcache->flushNs('photos');
             }
             if ($actions->selected->id == 'for_sale') {
                 $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been set as for-sale.', '%s photos have been set as for-sale.', $num), SwatString::numberFormat($num)));
             } else {
                 $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been set as not for-sale.', '%s photos have been set as not for-sale.', $num), SwatString::numberFormat($num)));
             }
             $this->page->app->messages->add($message);
             break;
         case 'publish':
         case 'status_action':
             $photos = $this->getPhotos($view);
             $num = count($photos);
             if ($ui->hasWidget('status_flydown')) {
                 $status = $ui->getWidget('status_flydown')->value;
             } else {
                 $status = PinholePhoto::STATUS_PUBLISHED;
             }
             foreach ($photos as $photo) {
                 $photo->setStatus($status);
                 $photo->save();
             }
             if (isset($this->page->app->memcache)) {
                 $this->page->app->memcache->flushNs('photos');
             }
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been updated to “%2$s”.', '%1$s photos have been updated to “%2$s”.', $num), SwatString::numberFormat($num), PinholePhoto::getStatusTitle($status)));
             $this->page->app->messages->add($message);
             break;
         case 'tags_action':
             $tag_array = $ui->getWidget('tags')->getSelectedTagArray();
             if (count($tag_array) > 0) {
                 $photos = $this->getPhotos($view);
                 $num = count($photos);
                 foreach ($photos as $photo) {
                     $photo->addTagsByName($tag_array);
                 }
                 if (isset($this->page->app->memcache)) {
                     $this->page->app->memcache->flushNs('photos');
                 }
                 if (count($tag_array) > 1) {
                     $message = new SwatMessage(sprintf(Pinhole::ngettext('%s tags have been added to one photo.', '%s tags have been added to %s photos.', $num), SwatString::numberFormat(count($tag_array)), SwatString::numberFormat($num)));
                 } else {
                     $message = new SwatMessage(sprintf(Pinhole::ngettext('A tag has been added to one photo.', 'A tag has been added to %s photos.', $num), SwatString::numberFormat($num)));
                 }
                 $this->page->app->messages->add($message);
             }
             // reset tag list
             $ui->getWidget('tags')->setSelectedTagArray(array());
             break;
     }
 }
 protected function displayQueue()
 {
     $sql = 'select count(id) from MailingListSubscribeQueue';
     $queued_updates = SwatDB::queryOne($this->db, $sql);
     if ($queued_updates > 0) {
         $this->debug(sprintf("\n%s Member Updates Queued. Remember to run the updater.\n", SwatString::numberFormat($queued_updates)), true);
     }
 }
    protected function displaySummary()
    {
        parent::displaySummary();
        $sql = 'select count(id) as count, rating, value
			from MailingListMemberUpdaterCache
			where field = %s
			group by value, rating
			order by value, rating';
        $sql = sprintf($sql, $this->db->quote($this->field, 'text'));
        $results = SwatDB::query($this->db, $sql);
        $current_segment = null;
        foreach ($results as $result) {
            if ($result->value !== $current_segment) {
                $current_segment = $result->value;
                $this->debug(sprintf("\nSegment %s:\n", $current_segment));
            }
            $this->debug(sprintf("%s%s Members: %s\n", str_repeat(' ', 5 - $result->rating), str_repeat('★', $result->rating), SwatString::numberFormat($result->count)));
        }
    }
Exemple #21
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;
        }
    }