/**
  * Called from __construct() as final step of object instantiation.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $module = new Digitalus_Module();
     $this->moduleData = $module->getData();
     $this->properties = Digitalus_Module_Property::load('mod_login');
 }
示例#2
0
 public function editAction()
 {
     $form = new Slide_Form();
     $mdlShow = new Slideshow_Show();
     $mdlSlide = new Slideshow_Slide();
     // generate path to save file to
     $id = $this->_request->getParam('id');
     $properties = Digitalus_Module_Property::load('mod_slideshow');
     $config = Zend_Registry::get('config');
     $path = $config->filepath->media;
     $directory = $path . '/' . $properties->mediaFolder . '/' . $mdlSlide->getShowBySlide($id);
     $directoryFull = $directory . '/full';
     $directoryPreview = $directory . '/preview';
     // create and set file's destination directory
     Digitalus_Filesystem_dir::makeRecursive(BASE_PATH, $directoryFull);
     Digitalus_Filesystem_dir::makeRecursive(BASE_PATH, $directoryPreview);
     $form->image->setDestination($directoryFull);
     $form->image_preview->setDestination($directoryPreview);
     if ($this->_request->isPost() && $this->_request->getParam('isInsert') != true) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             // success - do something with the uploaded file
             $values = $form->getValues();
             $imagePath = $form->image->getFileName();
             $previewPath = $form->image_preview->getFileName();
             // some servers set different permissions, so set them explicitly here
             if (!empty($imagePath)) {
                 chmod($imagePath, 0644);
             }
             if (!empty($previewPath)) {
                 chmod($previewPath, 0644);
             }
             // replace windows path separator
             $previewPath = str_replace("\\", PATH_SEPARATOR, $previewPath);
             $imagePath = str_replace("\\", PATH_SEPARATOR, $imagePath);
             $slide = $mdlSlide->updateSlide($values['id'], $values['title'], $values['caption'], $previewPath, $imagePath);
             $slide = $mdlSlide->openSlide($values['id']);
         }
     }
     $slide = $mdlSlide->openSlide($id);
     $slideArray['id'] = $slide->id;
     $slideArray['blog_id'] = $slide->showId;
     $slideArray['title'] = $slide->title;
     $slideArray['previewpath'] = $slide->previewPath;
     $slideArray['imagepath'] = $slide->imagePath;
     $slideArray['caption'] = $slide->caption;
     $form->setAction($this->baseUrl . '/mod_slideshow/slide/edit')->populate($slideArray);
     $show = $mdlShow->find($slide->showId)->current();
     $submit = $form->getElement('submit');
     $submit->setLabel($this->view->getTranslation('Update Slide'));
     $this->view->form = $form;
     $this->view->show = $show;
     $this->view->slide = $slide;
     $this->view->breadcrumbs[$show->name] = $this->baseUrl . '/mod_slideshow/show/edit/id/' . $show->id;
     $this->view->breadcrumbs[$slide->title] = $this->baseUrl . '/mod_slideshow/slide/edit/id/' . $slide->id;
     $this->view->toolbarLinks['Add to my bookmarks'] = $this->baseUrl . '/admin/index/bookmark/url/mod_slideshow/slide/edit/id/' . $slide->id;
     $this->view->toolbarLinks['Delete'] = $this->baseUrl . '/mod_slideshow/slide/delete/id/' . $slide->id;
 }
 /**
  * Called from __construct() as final step of object instantiation.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     //get the module data
     $module = new Digitalus_Module();
     $this->moduleData = $module->getData();
     $this->properties = Digitalus_Module_Property::load('mod_forward');
     $this->_redirect($this->moduleData->pagePath);
 }
示例#4
0
 /**
  * Rebuild action
  *
  * @return void
  */
 public function rebuildAction()
 {
     //this can take a lot of time
     set_time_limit(0);
     $properties = Digitalus_Module_Property::load('mod_search');
     //create the index
     $index = Zend_Search_Lucene::create($properties->pathToIndex);
     $adapters = $properties->adapters;
     foreach ($adapters as $adapter) {
         require_once $adapter->filepath;
         $className = $adapter->classname;
         $adapterObj = new $className();
         $pages = $adapterObj->getPages();
         if (is_array($pages) && count($pages) > 0) {
             foreach ($pages as $page) {
                 $index->addDocument($page->asLuceneDocument());
             }
         }
     }
     $index->optimize();
     $this->_forward('index');
     echo '<p><strong>' . $this->view->getTranslation('The search index was rebuilt successfully!') . '</strong></p><br />';
 }