/** * Sets up view * Alters response content type headers * Starts session * * @param Zend_Controller_Request_Abstract $request */ public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { $this->setupView(); parent::dispatchLoopStartup($request); // Since we're not using the cli sapi, instanciate the http protocol items if (!Zend_Session::isStarted() && !Zend_Session::sessionExists()) { if ($config = Zoo::getConfig('session', 'plugin')) { $options = $config->toArray(); if (isset($options['save_path'])) { $options['save_path'] = ZfApplication::$_data_path . $options['save_path']; if (!file_exists($options['save_path'])) { mkdir($options['save_path']); } } Zend_Session::setOptions($options); if ($config->save_handler) { $savehandlerClass = $config->save_handler; Zend_Session::setSaveHandler(new $savehandlerClass()); // Not ready yet } } Zend_Session::start(); } }
/** * Fetch a given panel * @param int $id * @return Flex_Panel */ function getPanel($id = 0) { if ($id == 0) { // Fetch from configuration $config = Zoo::getConfig('flex', 'module'); if ($config && $config->panel->default) { $id = $config->panel->default; } } return $this->find($id)->current(); }
/** * Adds module-specific language definitions * Sets response content type header * Loads module configuration * * @param Zend_Controller_Request_Abstract $request */ public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { $this->getResponse()->setHeader('Content-Type', 'text/plain; charset=utf-8'); // Load module configuration into registry Zend_Registry::set('moduleConfig', Zoo::getConfig($request->getModuleName(), 'module')); }
/** * Hook for node form - if type is Filemanager Node, add extra fields * * @param Zend_Form $form * @param array $arguments */ public function nodeForm(Zend_Form &$form, &$arguments) { $item =& array_shift($arguments); if ($item->type == "gallery_node") { $bgcolor = new Zoo_Form_Element_ColorPicker('gallery_bgcolor'); $bgcolor->setLabel('Background colour'); $config = Zoo::getConfig('gallery', 'module'); /* $topimage = new Zend_Form_Element_Radio('gallery_topimage'); $topimage->setLabel('Top image'); $topimage->setOptions(array('escape' => false)); $topimages = Zoo::getService('content')->getContent(array('parent' => $config->top_image, 'nodetype' => 'filemanager_file')); $topimage->addMultiOption(0, Zoo::_("None")); foreach ($topimages as $image) { $topimage->addMultiOption($image->id, $image->title."<br /><img src='".$image->hooks['filemanager_file']->getUrl(200)."' />"); } */ $topimage = new Zoo_Form_Element_FileBrowser('gallery_topimage'); $topimage->setLabel('Top image'); $bgimage = new Zoo_Form_Element_FileBrowser('gallery_bgimage'); $bgimage->setLabel('Background image'); $form->addElements(array($bgcolor, $topimage, $bgimage)); $options = array('legend' => Zoo::_("Gallery extras")); $form->addDisplayGroup(array('gallery_bgcolor', 'gallery_topimage', 'gallery_bgimage'), 'gallery_node', $options); if ($item->id > 0) { // Fetch extra information $top_image = Zoo::getService('link')->getLinkedNodes($item, 'top_image'); $populate['gallery_topimage'] = count($top_image) > 0 ? $top_image[0]->id : 0; $bg_image = Zoo::getService('link')->getLinkedNodes($item, 'bg_image'); $populate['gallery_bgimage'] = count($bg_image) > 0 ? $bg_image[0]->id : 0; $factory = new Gallery_Node_Factory(); $gnode = false; // Fetch estate object $gnode = $factory->find($item->id)->current(); if ($gnode) { $populate['gallery_bgcolor'] = $gnode->bgcolor; } $form->populate($populate); } } }