Example #1
0
 public function renderVimeoWidget($params = array())
 {
     # Prepare
     $oembed_endpoint = 'http://www.vimeo.com/api/oembed';
     # Extract
     $video_url = $params['content'];
     # Create the URLs
     $json_url = $oembed_endpoint . '.json?url=' . rawurlencode($video_url);
     # Load in the oEmbed Object
     $Oembed = @file_get_contents($json_url);
     if (!$Oembed) {
         return '<p>The Vimeo item could not be found.</p>';
     }
     $Oembed = json_decode($Oembed);
     # Apply the Model
     $model = compact('Oembed');
     $model = array_merge($params, $model);
     # Render
     return $this->view->getHelper('widget')->renderWidgetView(delve($params, 'partial', 'social/vimeo/vimeo'), $model);
 }
Example #2
0
 /**
  * Renders the Eventlist Widget
  * 
  * @param array 			$params [optional]
  * 							The following options are provided:
  * 
  * @return string 			The following params are sent back to partial:
  * 								Content:		The Content object which is rendering this widget
  * 								EventsPast:		A Doctrine_Collection of Event objects which occurred in the past
  * 								EventsFuture:	A Doctrine_Collection of Event objects which will occur in the future
  */
 public function renderEventlistWidget(array $params = array())
 {
     # Prepare
     $timestamp = date('Y-m-d H:i:s', time());
     # Fetch
     $Content = $this->getContentObjectFromParams($params);
     $EventsPast = Doctrine_Query::create()->select('*')->from('ContentEvent c, c.Parent cp')->where('c.status = ? AND cp.id = ?', array('published', $Content->id))->orderBy('c.event_start_at ASC, c.id ASC')->limit(20)->andWhere('c.event_start_at < ?', $timestamp)->execute();
     $EventsFuture = Doctrine_Query::create()->select('*')->from('ContentEvent c, c.Parent cp')->where('c.status = ? AND cp.id = ?', array('published', $Content->id))->orderBy('c.event_start_at ASC, c.id ASC')->limit(20)->andWhere('c.event_start_at >= ?', $timestamp)->execute();
     # Apply
     $model = compact('Content', 'EventsPast', 'EventsFuture');
     $model = array_merge($params, $model);
     # Render
     return $this->view->getHelper('widget')->renderWidgetView(delve($params, 'partial', 'content/eventlist/eventlist'), $model);
     # Free
     if (FREE_RESOURCES) {
         $EventsPast->free(true);
         $EventsFuture->free(true);
     }
     # Return result
     return $result;
 }
Example #3
0
 private function setUp(Zend_View_Interface $view)
 {
     if (!$this->isSetUp) {
         $helperName = 'Dfi_View_Helper_Navigation';
         $view->addHelperPath(_BASE_PATH . 'vendor/dafik/dfi/src/' . str_replace('_', '/', $helperName), $helperName);
     }
     /** @var $helper Zend_View_Helper_Navigation */
     $helper = $view->getHelper('navigation');
     if (!$this->isSetUp) {
         $helper->navigation($this->navigation);
         $aclPlugin = Zend_Controller_Front::getInstance()->getPlugin('Dfi_Controller_Plugin_Acl');
         if ($aclPlugin) {
             $acl = Zend_Registry::get('acl');
             /* @var $acl Zend_Acl */
             $identity = Zend_Auth::getInstance()->getIdentity();
             /* @var $identity SysUser */
             if ($acl && $identity) {
                 /* @var $helper Zend_View_Helper_Navigation_Menu */
                 $helper->setAcl($acl);
                 $helper->setRole((string) $identity->getRoleId());
             }
         }
         $this->isSetUp = true;
     }
     return $helper;
 }
Example #4
0
 /**
  * returns a callback to the plugin, this is used with the reflection API to
  * find out about the plugin's parameter names etc.
  *
  * should you need a rest array (i.e. for ZendFramework helpers) without the
  * possibility to edit the plugin's code, you can provide a callback to some
  * other function with the correct parameter signature, i.e. :
  * <code>
  * return array($this, "callbackHelper");
  * // and callbackHelper would be as such:
  * public function callbackHelper(array $rest=array()){}
  * </code>
  *
  * @param string $name the plugin name
  * @return callback
  */
 public function getCallback($name)
 {
     return array($this->view->getHelper($name), $name);
 }