Perforce Chronicle 2012.2/486814
API Documentation

Flickr_StreamController Class Reference

A widget that displays a flickr photo stream. More...

Inheritance diagram for Flickr_StreamController:
P4Cms_Widget_ControllerAbstract

List of all members.

Public Member Functions

 indexAction ()
 Provides information needed for initial render of javascript.

Static Public Member Functions

static getConfigSubForm ($widget)
 Get a widget config sub-form to present additional options to the user when configuring a widget instance.

Public Attributes

 $contexts

Detailed Description

A widget that displays a flickr photo stream.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

static Flickr_StreamController::getConfigSubForm ( widget) [static]

Get a widget config sub-form to present additional options to the user when configuring a widget instance.

Parameters:
P4Cms_Widget$widgetthe widget model instance being configured.
Returns:
Widget_Form_SubConfig the sub-form to integrate into the default widget config form.
    {
        return new Flickr_Form_StreamWidget;
    }
Flickr_StreamController::indexAction ( )

Provides information needed for initial render of javascript.

    {
        $view = $this->view;
        $widget = $this->_getWidget();

        // ensure that the api key has been set
        $values         = P4Cms_Module::fetch('Flickr')->getConfig()->toArray();
        $view->apiKey   = isset($values['key']) ? $values['key'] : '';
        
        // ensure that a type (tag/user/group) and key have been entered so the flickr search
        // can be performed
        $sourceType = $this->getOption('sourceType');
        $sourceKey  = $this->getOption('source' . $sourceType);

        if ($sourceType && $sourceKey) {
            $view->hasConfig = true;

            switch($sourceType) {
                case Flickr_Form_StreamWidget::SOURCE_TAG:
                    $view->tags         = $sourceKey;
                    break;
                case Flickr_Form_StreamWidget::SOURCE_USER:
                    $flickr             = new Zend_Service_Flickr($view->apiKey);
                    $view->userId       = $flickr->getIdByUsername($sourceKey);
                    break;
                case Flickr_Form_StreamWidget::SOURCE_GROUP:
                    $view->groupId      = $sourceKey;
                    break;
                default:
                    $view->hasConfig   = false;
            }

            $view->widgetId         = $widget->getId();
            $view->widgetRegion     = $widget->getValue('region');
            $view->imageDelay       = $this->getOption('imageDelay');
            $view->imageDimensions  = Flickr_Form_StreamWidget::$sizeDimensions[$this->getOption('imageSize')];
            $view->showTitle        = $this->getOption('showImageTitle');
        }
    }

Member Data Documentation

Flickr_StreamController::$contexts
Initial value:
 array(
        'image'     => array('json')
    )

The documentation for this class was generated from the following file: