Пример #1
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;
 }