imageActions() public static method

Check for, and handle, common image related actions.
public static imageActions ( string $actionID ) : boolean
$actionID string The action identifier.
return boolean True if an action was handled, otherwise false.
Example #1
0
 /**
  * Contructor.
  *
  * Also handles any actions from the view.
  *
  * @return Ansel_View_Results
  */
 public function __construct(array $params = array())
 {
     global $prefs, $conf, $injector, $notification;
     $ansel_storage = $injector->getInstance('Ansel_Storage');
     $this->_owner = Horde_Util::getFormData('owner', '');
     $this->_browser = new Ansel_TagBrowser($injector->getInstance('Ansel_Tagger'), null, $this->_owner);
     $this->_page = Horde_Util::getFormData('page', 0);
     $actionID = Horde_Util::getFormData('actionID', '');
     $image_id = Horde_Util::getFormData('image');
     $vars = Horde_Variables::getDefaultVariables();
     // Number perpage from prefs or config.
     $this->_perPage = min($prefs->getValue('tilesperpage'), $conf['thumbnail']['perpage']);
     // Common image actions.
     if (Ansel_ActionHandler::imageActions($actionID)) {
         Ansel::getUrlFor('view', array('view' => 'Results'), true)->redirect();
         exit;
     }
     // Tag browsing actions.
     switch ($actionID) {
         case 'remove':
             $tag = Horde_Util::getFormData('tag');
             if (isset($tag)) {
                 $this->_browser->removeTag($tag);
                 $this->_browser->save();
             }
             break;
         case 'add':
         default:
             $tag = Horde_Util::getFormData('tag');
             if (isset($tag)) {
                 $this->_browser->addTag($tag);
                 $this->_browser->save();
             }
             break;
     }
     // Check for empty tag search and redirect if empty
     if ($this->_browser->tagCount() < 1) {
         Horde::url('browse.php', true)->redirect();
         exit;
     }
 }
Example #2
0
File: Base.php Project: horde/horde
 /**
  * Constructor
  *
  * @param Ansel_View_Gallery  The view object for this renderer.
  */
 public function __construct(Ansel_View_Gallery $view = null)
 {
     $this->view = $view;
     Ansel_ActionHandler::imageActions(Horde_Util::getFormData('actionID'));
 }
Example #3
0
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Chuck Hagenbuch <*****@*****.**>
 * @author Michael J. Rubinsky <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('ansel');
// Get all the form data
$actionID = Horde_Util::getFormData('actionID');
$page = Horde_Util::getFormData('page', 0);
// None of the views on this page display side or top bars.
$page_output->topbar = $page_output->sidebar = false;
// Check basic image actions.
if (Ansel_ActionHandler::imageActions($actionID)) {
    $gallery_id = Horde_Util::getFormData('gallery');
    $gallery = $injector->getInstance('Ansel_Storage')->getGallery($gallery_id);
    $children = $gallery->countGalleryChildren(Horde_Perms::SHOW);
    $perpage = min($prefs->getValue('tilesperpage'), $conf['thumbnail']['perpage']);
    $pages = ceil($children / $perpage);
    if ($page > $pages) {
        $page = $pages;
    }
    // Return to the image list.
    Ansel::getUrlFor('view', array_merge(array('gallery' => $gallery_id, 'view' => 'Gallery', 'page' => $page, 'slug' => $gallery->get('slug')), $date), true)->redirect();
    exit;
}
// Edit actions?
if (!Ansel_ActionHandler::editActions($actionID)) {
    $page_output->header(array('title' => $title));