Exemplo n.º 1
0
 public function renderFileChecklist($values = array(), $parentId, $level = 0, $class = 'fileChecklist', $icon = null)
 {
     $links = array();
     $page = new Model_Page();
     $children = $page->getChildren($parentId);
     foreach ($children as $child) {
         $submenu = false;
         if ($page->hasChildren($child)) {
             $newLevel = $level + 1;
             $submenu = $this->view->renderFileChecklist($values, $child->id, $newLevel, $class, $icon);
         }
         // TODO: refactor into Toolbox String - replace empty spaces with underscores for element names only
         $childName = strtolower(str_replace(' ', '_', $child->name));
         $checked = 0;
         if (in_array($childName, $values)) {
             $checked = 1;
         }
         $form = new Digitalus_Form();
         $checkbox = $form->createElement('checkbox', $childName, array('value' => $checked, 'decorators' => array('ViewHelper'), 'belongsTo' => $class));
         $links[] = '<li>' . $checkbox . $this->getIcon($icon, $child->name) . $child->name . $submenu . '</li>';
     }
     $strClass = null;
     if (is_array($links)) {
         if ($level == 0) {
             $strClass = 'class="' . $class . '"';
         }
         $fileChecklist = '<ul ' . $strClass . 'class="treeview">' . implode(null, $links) . '</ul>';
         return $fileChecklist;
     }
 }
Exemplo n.º 2
0
 public function selectGroup($name, $value = null, $attribs = null, $currentGroup = null, $exclude = null, $excludeCurrent = true)
 {
     $mdlGroup = new Model_Group();
     $groups = $mdlGroup->getGroupNamesArray($exclude);
     $options[] = $this->view->getTranslation('Select Group');
     if (count($groups) > 0) {
         foreach ($groups as $group) {
             if (false == $excludeCurrent || (empty($currentGroup) || $group['name'] != $currentGroup)) {
                 if (isset($group['label']) && !empty($group['label'])) {
                     $options[$group['name']] = $group['label'];
                 } else {
                     $options[$group['name']] = $group['name'];
                 }
             }
         }
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options));
     if (is_array($value)) {
         $select->setValue($value);
     }
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 3
0
 /**
  * @param   string  $name   name of the select tag
  * @param   string  $value  value for the select tag
  * @param   array   $attr   attributes for the select tag
  * @return  string  HTML select element
  */
 public function selectTimezone($name, $value, $attribs = null)
 {
     $options = Digitalus_Validate_Timezone::getValidTimezones(null, true);
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options, 'value' => $value));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 4
0
 /**
  * @param   string  $name
  * @param   string  $value
  * @param   array   $attribs
  * @return  string  HTML radio input element
  */
 public function radioXmlDeclaration($name, $value, $attribs = null, $options = null, $listSep = "\n")
 {
     $options = array('always' => $this->view->getTranslation('Always'), 'never' => $this->view->getTranslation('Never'), 'browser' => $this->view->getTranslation('By browser check'));
     $form = new Digitalus_Form();
     $radio = $form->createElement('radio', $name, array('multiOptions' => $options, 'value' => $value, 'listSep' => $listSep));
     if (is_array($attribs)) {
         $radio->setAttribs($attribs);
     }
     return $radio;
 }
Exemplo n.º 5
0
 /**
  *
  */
 public function selectDoctype($name, $value, $attribs = null)
 {
     $options = array('XHTML1_TRANSITIONAL' => 'XHTML1_TRANSITIONAL', 'XHTML11' => 'XHTML11', 'XHTML1_STRICT' => 'XHTML1_STRICT', 'XHTML1_FRAMESET' => 'XHTML1_FRAMESET', 'XHTML_BASIC1' => 'XHTML_BASIC1', 'HTML4_STRICT' => 'HTML4_STRICT', 'HTML4_LOOSE' => 'HTML4_LOOSE', 'HTML4_FRAMESET' => 'HTML4_FRAMESET');
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options, 'value' => $value));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 6
0
 public function selectAdminRole($name, $value, $attribs = false)
 {
     $options['admin'] = $this->view->getTranslation('Site Administrator');
     $options['superadmin'] = $this->view->getTranslation('Super Administrator');
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options, 'value' => $value));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 7
0
 /**
  *
  */
 public function selectLanguage($name, $value, $attribs = null)
 {
     //select version
     $config = Zend_Registry::get('config');
     $siteVersions = $config->language->translations;
     foreach ($siteVersions as $locale => $label) {
         $options[$locale] = $this->view->getTranslation($label);
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options, 'value' => $value));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 8
0
 /**
  *
  */
 public function selectBlog($name, $value)
 {
     $mdlBlog = new Blog_Blog();
     $blogs = $mdlBlog->getBlogs();
     if ($blogs == null) {
         return $this->view->getTranslation('There are no blogs to view!');
     } else {
         $options[] = $this->view->getTranslation('Select One');
         foreach ($blogs as $blog) {
             $options[$blog->id] = $blog->name;
         }
         $form = new Digitalus_Form();
         $select = $form->createElement('select', $name, array('multiOptions' => $options, 'belongsTo' => 'module'));
         return $select;
     }
 }
Exemplo n.º 9
0
 /**
  *
  */
 public function selectSlideshow($name, $value)
 {
     $mdlShow = new Slideshow_Show();
     $shows = $mdlShow->getShows();
     if ($shows == null) {
         return $this->view->getTranslation('There are no slideshows to view!');
     } else {
         $options[] = $this->view->getTranslation('Select One');
         foreach ($shows as $show) {
             $options[$show->id] = $show->name;
         }
         $form = new Digitalus_Form();
         $select = $form->createElement('select', $name, array('multiOptions' => $options, 'belongsTo' => 'module'));
         return $select;
     }
 }
Exemplo n.º 10
0
 public function selectModule($name, $value, $attribs = array())
 {
     $options = array();
     $modules = Digitalus_Filesystem_Dir::getDirectories(APPLICATION_PATH . '/modules');
     if (is_array($modules)) {
         $options[] = $this->view->getTranslation('Select a module');
         $options = array_merge($options, $this->_getModuleForms());
         $attribs['multiple'] = false;
         $form = new Digitalus_Form();
         $select = $form->createElement('select', $name, array('multiOptions' => $options, 'value' => $value, 'belongsTo' => $name));
         if (is_array($attribs)) {
             $select->setAttribs($attribs);
         }
         return $select;
     } else {
         return $this->view->getTranslation('There are no modules currently installed');
     }
 }
Exemplo n.º 11
0
 public function selectPage($name, $value = null, $attribs = null)
 {
     $mdlIndex = new Model_Page();
     $index = $mdlIndex->getIndex(0, 'name');
     $options = array();
     $options[0] = $this->view->getTranslation('Site Root');
     if (is_array($index)) {
         foreach ($index as $id => $page) {
             $options[$id] = $page;
         }
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 12
0
 /**
  *
  */
 public function selectDesign($name, $value = null, $attribs = null, $options = null)
 {
     $templateConfig = Zend_Registry::get('config')->template;
     $templates = Digitalus_Filesystem_Dir::getDirectories(BASE_PATH . '/' . $templateConfig->pathToTemplates . '/public');
     foreach ($templates as $template) {
         $designs = Digitalus_Filesystem_File::getFilesByType(BASE_PATH . '/' . $templateConfig->pathToTemplates . '/public/' . $template . '/pages', 'xml');
         if (is_array($designs)) {
             foreach ($designs as $design) {
                 $design = Digitalus_Toolbox_Regex::stripFileExtension($design);
                 $options[$template . '_' . $design] = $template . ' / ' . $design;
             }
         }
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options, 'value' => $value));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Exemplo n.º 13
0
 public function selectModulePage($name, $module, $value, $attribs = null)
 {
     $pages = Digitalus_Filesystem_File::getFilesByType(APPLICATION_PATH . '/modules/' . $module . '/views/scripts/public', 'phtml');
     if (is_array($pages)) {
         $options[] = $this->view->getTranslation('Select One');
         foreach ($pages as $page) {
             $page = Digitalus_Toolbox_Regex::stripFileExtension($page);
             $options[$page] = $page;
         }
         $form = new Digitalus_Form();
         $select = $form->createElement('select', $name, array('multiOptions' => $options));
         if (is_array($value)) {
             $select->setValue($value);
         }
         if (is_array($attribs)) {
             $select->setAttribs($attribs);
         }
         return $select;
     } else {
         return $this->view->getTranslation('There are no pages in this module');
     }
 }
Exemplo n.º 14
0
 public function selectUser($name, $value = null, $attribs = null, $currentUser = 0)
 {
     $u = new Model_User();
     $users = $u->fetchAll(null, 'first_name');
     $options[] = $this->view->getTranslation('Select User');
     if ($users->count() > 0) {
         foreach ($users as $user) {
             if ($user->name != $currentUser) {
                 $options[$user->name] = $user->first_name . ' ' . $user->last_name;
             }
         }
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options));
     if (is_array($value)) {
         $select->setValue($value);
     }
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }