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; }
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; } }
/** * */ 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; }
/** * @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; }
/** * @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; }
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; }
/** * */ 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; }
/** * */ 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; } }
public function __construct($options = null) { parent::__construct($options); $this->addElementPrefixPath('Digitalus_Decorator', 'Digitalus/Form/Decorator', 'decorator')->addPrefixPath('Digitalus_Form_Element', 'Digitalus/Form/Element/', 'element')->setMethod('post')->setEnctype('multipart/form-data'); $id = $this->createElement('hidden', 'id'); $id->removeDecorator('Label'); $show = $this->createElement('hidden', 'show_id'); $show->removeDecorator('Label'); $title = $this->createElement('text', 'title'); $title->setLabel($this->getView()->getTranslation('Title') . ':'); // create new element $imagepath = $this->createElement('hidden', 'previewpath'); // element options $imagepath->setLabel($this->getView()->getTranslation('Current Image'))->setRequired(false)->setDecorators(array(array('ViewScript', array('viewScript' => 'slide/render-image.phtml', 'class' => 'partial')))); // create new element $imagePreview = $this->createElement('file', 'image_preview'); // element options $imagePreview->setLabel($this->getView()->getTranslation('Image Preview (scaled)'))->setRequired(false)->setRequired(false)->addValidator('Count', false, 1)->addValidator('Size', false, 204800)->addValidator('Extension', false, 'jpg, png, gif'); // only JPEG, PNG, und GIF allowed // create new element $image = $this->createElement('file', 'image'); // element options $image->setLabel($this->getView()->getTranslation('Image'))->setRequired(false)->addValidator('Count', false, 1)->addValidator('Size', false, 1024000)->addValidator('Extension', false, 'jpg, png, gif'); // only JPEG, PNG, und GIF allowed $caption = $this->createElement('textarea', 'caption'); $caption->setLabel($this->getView()->getTranslation('Caption'))->setAttrib('cols', 40)->setAttrib('rows', 8); $submit = $this->createElement('submit', 'submit'); // add the elements to the form $this->addElement($id)->addElement($show)->addElement($title)->addElement($imagepath)->addElement($imagePreview)->addElement($imagepath)->addElement($image)->addElement($caption)->addElement($submit); }
/** * */ 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; } }
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'); } }
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; }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); $hidden = $this->createElement('hidden', 'name'); $groups = $view->selectGroup('from_groupname', null, null, $this->_groupName, 'superadmin'); $submit = $this->createElement('submit', 'update', array('label' => $view->getTranslation('Copy Permissions'), 'attribs' => array('class' => 'submit'))); $this->addElement($hidden)->addElement($groups)->addElement($submit)->setAttribs(array('class' => 'padding-10')); }
public function __construct($options = null) { parent::__construct($options); $view = $this->getView(); $this->setAction($view->getBaseUrl() . Digitalus_Uri::get())->setAttrib('id', 'searchForm'); $submitSearchForm = $this->createElement('hidden', 'submitSearchForm', array('value' => 1)); $keywords = $this->createElement('text', 'keywords', array('required' => true, 'label' => $view->getTranslation('Keywords'), 'attribs' => array('size' => 50), 'validators' => array(array('NotEmpty', true)), 'errorMessages' => array($view->getTranslation('Please provide a keyword to search for!')))); $submit = $this->createElement('submit', 'submit', array('label' => $view->getTranslation('Search'), 'attribs' => array('class' => 'submit'))); $this->addElement($submitSearchForm)->addElement($keywords)->addElement($submit)->addDisplayGroup(array('form_instance', 'submitSearchForm', 'keywords', 'submit'), 'guestbookGroup', array('legend' => $view->getTranslation('Search Site'))); }
/** * */ 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; }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); // create new element $id = $this->createElement('hidden', 'id', array('decorators' => array('ViewHelper'))); $this->addElement($id); // create new element $name = $this->createElement('text', 'page_name', array('label' => $view->getTranslation('Page Name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, Model_Page::PAGE_NAME_LENGTH)), array('Regex', true, array('pattern' => Model_Page::PAGE_NAME_REGEX, 'messages' => array('regexNotMatch' => Model_Page::PAGE_NAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 50), 'order' => 0)); $this->addElement($name); // add options for parent page $multiOptions = array(0 => $view->getTranslation('Site Root')); $mdlIndex = new Model_Page(); $index = $mdlIndex->getIndex(0, 'name'); if (is_array($index)) { foreach ($index as $id => $page) { $multiOptions[$id] = $page; } } // create new element $parentId = $this->createElement('select', 'parent_id', array('label' => $view->getTranslation('Parent page') . ':', 'required' => true, 'multiOptions' => $multiOptions, 'order' => 1)); $this->addElement($parentId); // add options for template $multiOptions = array(); $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); $multiOptions[$template . '_' . $design] = $view->getTranslation($template) . ' / ' . $view->getTranslation($design); } } } // create new element $contentTemplate = $this->createElement('select', 'content_template', array('label' => $view->getTranslation('Template') . ':', 'required' => true, 'multiOptions' => $multiOptions, 'order' => 2)); $this->addElement($contentTemplate); // create new element $continue = $this->createElement('checkbox', 'continue_adding_pages', array('label' => $view->getTranslation('Continue adding pages') . '?', 'order' => 3)); $this->addElement($continue); // create new element $showOnMenu = $this->createElement('checkbox', 'show_on_menu', array('label' => $view->getTranslation('Show Page on menu') . '?', 'order' => 4)); $this->addElement($showOnMenu); // create new element $publish = $this->createElement('checkbox', 'publish_pages', array('label' => $view->getTranslation('Publish page instantly') . '?', 'order' => 5)); $this->addElement($publish); // create new element $submit = $this->createElement('submit', 'submitPageForm', array('label' => $view->getTranslation('Submit'), 'attribs' => array('class' => 'submit'), 'order' => 1000)); $this->addElement($submit); $this->addDisplayGroup(array('form_instance', 'id', 'page_name', 'parent_id', 'content_template', 'continue_adding_pages', 'show_on_menu', 'publish_pages', 'submitPageForm'), 'createPageGroup'); }
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'); } }
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; }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); // create new element $id = $this->createElement('hidden', 'id', array('decorators' => array('ViewHelper'))); // create new element $openid = $this->createElement('text', 'openid_identifier', array('label' => $view->getTranslation('OpenID'), 'required' => true, 'filters' => array('StringTrim'), 'attribs' => array('size' => 50, 'class' => 'openid_login'), 'errorMessages' => array('You must enter a valid OpenID.'))); $submit = $this->createElement('submit', 'openid_action', array('label' => $view->getTranslation('Login'), 'attribs' => array('class' => 'submit'))); // add the elements to the form $this->addElement($id)->addElement($openid)->addElement($submit)->addDisplayGroup(array('form_instance', 'id', 'openid_identifier', 'openid_action'), 'adminOpenIdGroup', array('legend' => $view->getTranslation('OpenID Login'))); $this->setDecorators(array('FormElements', 'Form')); $this->setDisplayGroupDecorators(array('FormElements', 'Fieldset')); }
public function init() { parent::init(); $view = $this->getView(); $front = Zend_Controller_Front::getInstance(); $page_id = $this->createElement('hidden', 'id', array('required' => true)); $language = $this->createElement('hidden', 'language'); $name = $this->createElement('text', 'name', array('label' => $view->getTranslation('Page Name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, Model_Page::PAGE_NAME_LENGTH)), array('PagenameExistsNot'), array('Regex', true, array('pattern' => Model_Page::PAGE_NAME_REGEX, 'messages' => array('regexNotMatch' => Model_Page::PAGE_NAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 50), 'order' => 1)); $label = $this->createElement('text', 'label', array('label' => $view->getTranslation('Page Label'), 'filters' => array('StringTrim', 'StripTags'), 'attribs' => array('size' => 50), 'order' => 2)); $headline = $this->createElement('text', 'headline', array('label' => $view->getTranslation('Page Headline'), 'filters' => array('StringTrim', 'StripTags'), 'attribs' => array('size' => 50), 'order' => 3)); $submit = $this->createElement('submit', 'submit', array('label' => $view->getTranslation('Save Changes'), 'attribs' => array('class' => 'submit'), 'order' => 1000)); $this->setAction($front->getBaseUrl() . self::PAGE_ACTION); $this->addElement($page_id)->addElement($language)->addElement($name)->addElement($label)->addElement($headline)->addElement($submit)->setAttrib('enctype', 'multipart/form-data')->setDecorators(array('FormElements', 'Form', array('FormErrors', array('placement' => 'prepend'))))->setDisplayGroupDecorators(array('FormElements', 'Fieldset')); }
public function __construct($options = null) { parent::__construct($options); $this->setMethod('post'); $id = $this->createElement('hidden', 'id'); $id->removeDecorator('Label'); $name = $this->createElement('text', 'name'); $name->setAttrib('size', 40)->setRequired('true')->setLabel($this->getView()->getTranslation('Slideshow Name') . ':'); // create new element $description = $this->createElement('textarea', 'description'); // element options $description->setLabel($this->getView()->getTranslation('Description'))->setRequired(false)->setAttrib('cols', 40)->setAttrib('rows', 8); $submit = $this->createElement('submit', 'submit'); // add the elements to the form $this->addElement($id)->addElement($name)->addElement($description)->addElement($submit); }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); // create new element $id = $this->createElement('hidden', 'id', array('decorators' => array('ViewHelper'))); // create new element $userName = $this->createElement('text', 'adminUsername', array('label' => $view->getTranslation('Username'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, 20)), array('Regex', true, array('pattern' => Model_User::USERNAME_REGEX, 'messages' => array('regexNotMatch' => Model_User::USERNAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 50), 'errorMessages' => array('You must enter a valid username.'))); // create new element $password = $this->createElement('password', 'adminPassword', array('label' => $view->getTranslation('Password'), 'required' => true, 'filters' => array('StringTrim'), 'errorMessages' => array('You must enter your password.'))); $submit = $this->createElement('submit', 'submitAdminLogin', array('label' => $view->getTranslation('Login'), 'attribs' => array('class' => 'submit'))); // add the elements to the form $this->addElement($id)->addElement($userName)->addElement($password)->addElement($submit)->addDisplayGroup(array('form_instance', 'id', 'adminUsername', 'adminPassword', 'submitAdminLogin'), 'adminLoginGroup', array('legend' => $view->getTranslation('Standard Login'))); $this->setDecorators(array('FormElements', 'Form')); $this->setDisplayGroupDecorators(array('FormElements', 'Fieldset')); }
public function __construct($options = null) { parent::__construct($options); $view = $this->getView(); //this page should post back to itself $this->setAction($_SERVER['REQUEST_URI'])->setMethod('post'); $name = $this->createElement('text', 'name'); $name->setLabel($view->getTranslation('Your Name') . ': ')->setRequired(true)->addFilter('StripTags')->addErrorMessage($view->getTranslation('Your name is required!'))->setAttrib('size', 30); $email = $this->createElement('text', 'email'); $email->setLabel($view->getTranslation('Your Email') . ': ')->setRequired(true)->addValidator('EmailAddress')->addErrorMessage($view->getTranslation('Invalid email address!'))->setAttrib('size', 30); $subject = $this->createElement('text', 'subject'); $subject->setLabel($view->getTranslation('Subject') . ': ')->setRequired(true)->addFilter('StripTags')->addErrorMessage($view->getTranslation('The subject is required!'))->setAttrib('size', 40); $message = $this->createElement('textarea', 'message'); $message->setLabel($view->getTranslation('Message') . ': ')->setRequired(true)->addErrorMessage($view->getTranslation('The message is required!'))->setAttrib('cols', 35)->setAttrib('rows', 10); $font = APPLICATION_PATH . 'admin/data/fonts/AceCrikey.ttf'; $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $view->getTranslation("Please verify you're a human") . ':', 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 6, 'timeout' => 300, 'height' => 100, 'width' => 260))); $submit = $this->createElement('submit', 'submitContactForm'); $submit->setlabel($view->getTranslation('Send Message'))->setAttribs(array('class' => 'submit')); $this->addElement($name)->addElement($email)->addElement($subject)->addElement($message)->addElement($captcha)->addElement($submit)->addDisplayGroup(array('form_instance', 'name', 'email', 'subject', 'message', 'captcha', 'submitContactForm'), 'contact', array('legend' => $view->getTranslation('Contact'))); }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); // create new element $groupName = $this->createElement('text', 'name', array('label' => $view->getTranslation('Group name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, Model_Group::GROUPNAME_LENGTH)), array('Regex', true, array('pattern' => Model_Group::GROUPNAME_REGEX, 'messages' => array('regexNotMatch' => Model_Group::GROUPNAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 40))); // create new element $groupParent = $view->selectGroup('parent', null, null, null, 'superadmin'); $groupParent->setOptions(array('label' => $view->getTranslation('Parent group'))); // create new element $groupLabel = $this->createElement('text', 'label', array('label' => $view->getTranslation('Group label'), 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('StringLength', true, array(0, 30))), 'attribs' => array('cols' => 32, 'rows' => 5))); // create new element $groupDescription = $this->createElement('textarea', 'description', array('label' => $view->getTranslation('Group description'), 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('StringLength', true, array(0, 200))), 'attribs' => array('cols' => 32, 'rows' => 5))); $adminList = $this->createElement('AnyMarkup', 'admin_resources', array('decorators' => array('ViewHelper'), 'belongsTo' => 'acl_resources')); $moduleList = $this->createElement('AnyMarkup', 'module_resources', array('decorators' => array('ViewHelper'), 'belongsTo' => 'acl_resources')); $publicList = $this->createElement('AnyMarkup', 'public_resources', array('decorators' => array('ViewHelper'), 'belongsTo' => 'acl_resources')); $submitPermissions = $this->createElement('submit', 'update_permissions', array('label' => $view->getTranslation('Update Permissions'), 'decorators' => array('ViewHelper'), 'attribs' => array('class' => 'submit'))); $submit = $this->createElement('submit', 'submitAdminGroupForm', array('label' => $view->getTranslation('Submit'), 'attribs' => array('class' => 'submit'))); // add the elements to the form $this->addElement($groupName)->addElement($groupParent)->addElement($groupLabel)->addElement($groupDescription)->addElement($adminList)->addElement($moduleList)->addElement($publicList)->addElement($submitPermissions)->addElement($submit)->setAttribs(array('id' => 'permissions', 'class' => 'padding-10'))->addDisplayGroup(array('form_instance', 'name', 'parent', 'label', 'description', 'submitAdminGroupForm'), 'generalGroup', array('legend' => $view->getTranslation('User Group'), 'id' => 'general'))->addDisplayGroup(array('admin_resources', 'update_permissions'), 'adminAclGroup', array('legend' => $view->getTranslation('Admin Permissions'), 'id' => 'admin_permissions'))->addDisplayGroup(array('module_resources', 'update_permissions'), 'moduleAclGroup', array('legend' => $view->getTranslation('Module Permissions'), 'id' => 'module_permissions'))->addDisplayGroup(array('public_resources', 'update_permissions'), 'publicAclGroup', array('legend' => $view->getTranslation('Public Permissions'), 'id' => 'public_permissions')); }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); $pageId = $this->createElement('hidden', 'page_id'); $pageId->addFilter('int'); $pageTitle = $this->createElement('text', 'page_title'); $pageTitle->setLabel($view->getTranslation('Page Title') . ':')->addFilter('StripTags')->setAttrib('class', 'med'); $filename = $this->createElement('text', 'filename'); $filename->setLabel($view->getTranslation('Filename') . ':')->addFilter('StripTags')->setAttrib('class', 'med'); $metaDescription = $this->createElement('textarea', 'meta_description'); $metaDescription->setLabel($view->getTranslation('Meta Description') . ':')->addFilter('StripTags')->setAttrib('class', 'med_short'); $metaKeywords = $this->createElement('textarea', 'keywords'); $metaKeywords->setLabel($view->getTranslation('Meta Keywords') . ':')->addFilter('StripTags')->setAttrib('class', 'med_short'); $searchTags = $this->createElement('textarea', 'search_tags'); $searchTags->setLabel($view->getTranslation('Search Tags') . ':')->addFilter('StripTags')->setAttrib('class', 'med_short'); $submit = $this->createElement('submit', 'update'); $submit->setLabel($view->getTranslation('Update Meta Data')); // Add elements to form: $this->addElement($pageId)->addElement($pageTitle)->addElement($filename)->addElement($metaDescription)->addElement($metaKeywords)->addElement($searchTags)->addElement($submit); $this->addDisplayGroup(array('form_instance', 'page_id', 'page_title', 'filename', 'meta_description', 'keywords', 'search_tags', 'update'), 'updatePageMetaDataGroup', array('legend' => $view->getTranslation('Edit Meta Data'))); }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); // create new element # $id = $this->createElement('hidden', 'id', array( # 'decorators' => array('ViewHelper') # )); // create new element $userName = $this->createElement('text', 'name', array('label' => $view->getTranslation('Username'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, Model_User::USERNAME_LENGTH)), array('Regex', true, array('pattern' => Model_User::USERNAME_REGEX, 'messages' => array('regexNotMatch' => Model_User::USERNAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 40))); // create new element $firstName = $this->createElement('text', 'first_name', array('label' => $view->getTranslation('First name'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, 40)), array('Regex', true, array('pattern' => Model_User::USERNAME_REGEX, 'messages' => array('regexNotMatch' => Model_User::USERNAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 40))); // create new element $lastName = $this->createElement('text', 'last_name', array('label' => $view->getTranslation('Last name'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, 40)), array('Regex', true, array('pattern' => Model_User::USERNAME_REGEX, 'messages' => array('regexNotMatch' => Model_User::USERNAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 40))); // create new element $email = $this->createElement('text', 'email', array('label' => $view->getTranslation('Email address'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('EmailAddress'), 'attribs' => array('size' => 50), 'errorMessages' => array('A valid email address is required'))); // create new element $openid = $this->createElement('text', 'openid', array('label' => $view->getTranslation('OpenID'), 'filters' => array('StringTrim'), 'validators' => array('OpenIdExists'), 'attribs' => array('size' => 50))); // create new element $updatePassword = $this->createElement('checkbox', 'update_password', array('label' => $view->getTranslation('Update Password?'), 'checked' => false)); // create new element $active = $this->createElement('checkbox', 'active', array('label' => $view->getTranslation('Activated'), 'checked' => true)); // create new element $adminRole = $view->selectGroup('role', null, null, null, 'superadmin', false); $adminRole->setOptions(array('label' => $view->getTranslation('Admin Role'), 'required' => true)); // create new element $password = $this->createElement('password', 'password', array('label' => $view->getTranslation('Password'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true)), 'attribs' => array('size' => 50))); // create new element $passwordConfirm = $this->createElement('password', 'password_confirm', array('label' => $view->getTranslation('Confirm Password'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true), array('IdenticalField', true, array('password', 'Confirm Password'))), 'attribs' => array('size' => 50))); $captcha = $this->createElement('captcha', 'captcha', array('label' => $view->getTranslation("Please verify you're a human!") . ':', 'required' => true, 'filters' => array('StringTrim'), 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 6, 'timeout' => 300, 'height' => 100, 'width' => 260), 'errorMessages' => array('Please type in the correct code from the captcha!'))); $submit = $this->createElement('submit', 'submitAdminUserForm', array('label' => $view->getTranslation('Submit'), 'attribs' => array('class' => 'submit'))); // add the elements to the form $this->addElement($userName)->addElement($firstName)->addElement($lastName)->addElement($email)->addElement($openid)->addElement($updatePassword)->addElement($active)->addElement($adminRole)->addElement($password)->addElement($passwordConfirm)->addElement($captcha)->addElement($submit)->addDisplayGroup(array('form_instance', 'name', 'first_name', 'last_name', 'email', 'openid', 'update_password', 'active', 'role', 'password', 'password_confirm', 'captcha', 'submitAdminUserForm'), 'adminUserGroup', array('legend' => $view->getTranslation('Account Information'))); $this->setDecorators(array('FormElements', 'Form')); $this->setDisplayGroupDecorators(array('FormElements', 'Fieldset')); }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); $mdlSettings = new Model_SiteSettings(); $settings = $mdlSettings->toObject(); /* ********************************************************************* * SITE * ****************************************************************** */ $siteName = $this->createElement('text', 'name', array('label' => $view->getTranslation('Site name'), 'value' => $settings->name, 'belongsTo' => 'setting', 'filters' => array('StringTrim', 'StripTags'))); $siteTitle = $this->createElement('text', 'title_separator', array('label' => $view->getTranslation('Title separator'), 'value' => $settings->title_separator, 'belongsTo' => 'setting', 'attribs' => array('class' => 'med'), 'filters' => array('StripTags'))); $siteOnline = $this->createElement('checkbox', 'online', array('label' => $view->getTranslation('Site is online'), 'value' => intval($settings->online), 'belongsTo' => 'setting', 'description' => $view->getTranslation('Status'))); $siteSubmit = $this->createElement('submit', 'site', array('label' => $view->getTranslation('Update General Site Settings'), 'attribs' => array('class' => 'submit'))); $this->addElement($siteName); $this->addElement($siteTitle); $this->addElement($siteOnline); $this->addElement($siteSubmit); $this->addDisplayGroup(array('form_instance', 'name', 'title_separator', 'online', 'site'), 'siteGroup', array('legend' => $view->getTranslation('General settings'))); /* ********************************************************************* * CONTENT * ****************************************************************** */ $homePage = $view->selectPage('home_page'); $homePage->setOptions(array('label' => $view->getTranslation('Home Page'), 'value' => $settings->home_page, 'belongsTo' => 'setting')); $pageNotFound = $view->selectPage('page_not_found'); $pageNotFound->setOptions(array('label' => $view->getTranslation('404 Page'), 'value' => $settings->page_not_found, 'belongsTo' => 'setting')); $offlinePage = $view->selectPage('offline_page'); $offlinePage->setOptions(array('label' => $view->getTranslation('Site Offline Page'), 'value' => $settings->offline_page, 'belongsTo' => 'setting')); $addMenuLinks = $this->createElement('checkbox', 'add_menu_links', array('label' => $view->getTranslation('Automatically add menu links'), 'value' => intval($settings->add_menu_links), 'belongsTo' => 'setting', 'description' => $view->getTranslation('Menu links'))); $publishPages = $this->createElement('checkbox', 'publish_pages', array('label' => $view->getTranslation('Automatically publish pages on creation'), 'value' => intval($settings->publish_pages), 'belongsTo' => 'setting', 'description' => $view->getTranslation('Publish Pages'))); $contentSubmit = $this->createElement('submit', 'content', array('label' => $view->getTranslation('Update Content Settings'), 'attribs' => array('class' => 'submit'))); $this->addElement($homePage); $this->addElement($pageNotFound); $this->addElement($offlinePage); $this->addElement($addMenuLinks); $this->addElement($publishPages); $this->addElement($contentSubmit); $this->addDisplayGroup(array('form_instance', 'home_page', 'page_not_found', 'offline_page', 'add_menu_links', 'publish_pages', 'content'), 'contentGroup', array('legend' => $view->getTranslation('Managing Content'))); /* ********************************************************************* * DESIGN * ****************************************************************** */ $designConfig = Zend_Registry::get('config')->template->default->public; $currentDesign = isset($settings->default_design) ? $settings->default_design : $designConfig->template . '_' . $designConfig->page; $defaultDesign = $view->selectDesign('default_design', $currentDesign); $defaultDesign->setOptions(array('label' => $view->getTranslation('Default design'), 'value' => $currentDesign, 'belongsTo' => 'setting')); $designSubmit = $this->createElement('submit', 'design', array('label' => $view->getTranslation('Update Design Settings'), 'attribs' => array('class' => 'submit'))); $this->addElement($defaultDesign); $this->addElement($designSubmit); $this->addDisplayGroup(array('form_instance', 'default_design', 'design'), 'designGroup', array('legend' => $view->getTranslation('Design'))); /* ********************************************************************* * META DATA * ****************************************************************** */ $xmlDeclaration = $view->radioXmlDeclaration('xml_declaration', $settings->xml_declaration); $xmlDeclaration->setOptions(array('label' => $view->getTranslation('XML declaration'), 'value' => $settings->xml_declaration, 'belongsTo' => 'setting', 'description' => $view->getTranslation('XML declaration'))); $docType = $view->selectDoctype('doc_type', $settings->doc_type); $docType->setOptions(array('label' => $view->getTranslation('Doc Type'), 'value' => $settings->doc_type, 'belongsTo' => 'setting')); $defaultCharset = $this->createElement('text', 'default_charset', array('label' => $view->getTranslation('Default charset'), 'value' => $settings->default_charset, 'belongsTo' => 'setting', 'filters' => array('StringTrim', 'StripTags'))); $defaultTimezone = $view->selectTimezone('default_timezone', $settings->default_timezone); $defaultTimezone->setOptions(array('label' => $view->getTranslation('Default timezone'), 'value' => $settings->default_timezone, 'belongsTo' => 'setting', 'validators' => array('Timezone'))); $metaSubmit = $this->createElement('submit', 'meta', array('label' => $view->getTranslation('Update Page Meta Data'), 'attribs' => array('class' => 'submit'))); $this->addElement($xmlDeclaration); $this->addElement($docType); $this->addElement($defaultCharset); $this->addElement($defaultTimezone); $this->addElement($metaSubmit); $this->addDisplayGroup(array('form_instance', 'xml_declaration', 'doc_type', 'default_charset', 'default_timezone', 'meta'), 'metaGroup', array('legend' => $view->getTranslation('Meta Data'))); /* ********************************************************************* * INTERNATIONALISATION * ****************************************************************** */ $defaultLanguage = $view->selectLanguage('default_language', $settings->default_language); $defaultLanguage->setOptions(array('label' => $view->getTranslation('Default language'), 'value' => $settings->default_language, 'belongsTo' => 'setting')); $adminLanguageValue = $view->getAdminLanguage(); $adminLanguage = $view->selectLanguage('admin_language', $settings->admin_language); $adminLanguage->setOptions(array('label' => $view->getTranslation('Admin language'), 'value' => $adminLanguageValue, 'belongsTo' => 'setting')); $internationalSubmit = $this->createElement('submit', 'language', array('label' => $view->getTranslation('Update Internationalization Settings'), 'attribs' => array('class' => 'submit'))); $this->addElement($defaultLanguage); $this->addElement($adminLanguage); $this->addElement($internationalSubmit); $this->addDisplayGroup(array('form_instance', 'default_language', 'admin_language', 'language'), 'internationalGroup', array('legend' => $view->getTranslation('Internationalization'))); /* ********************************************************************* * EMAIL * ****************************************************************** */ $defaultEmail = $this->createElement('text', 'default_email', array('label' => $view->getTranslation('Default email address'), 'value' => $settings->default_email, 'belongsTo' => 'setting', 'filters' => array('StringTrim'), 'validators' => array('EmailAddress'), 'errorMessages' => array('A valid email address is required'))); $defaultEmailSender = $this->createElement('text', 'default_email_sender', array('label' => $view->getTranslation('Default sender'), 'value' => $settings->default_email_sender, 'belongsTo' => 'setting', 'filters' => array('StringTrim', 'StripTags'))); $useSmtpMail = $this->createElement('checkbox', 'use_smtp_mail', array('label' => $view->getTranslation('Use SMTP Transport'), 'value' => intval($settings->use_smtp_mail), 'belongsTo' => 'setting', 'description' => $view->getTranslation('Transport'), 'filters' => array('StringTrim', 'StripTags'))); $smtpHost = $this->createElement('text', 'smtp_host', array('label' => $view->getTranslation('SMTP host'), 'value' => $settings->smtp_host, 'belongsTo' => 'setting', 'filters' => array('StringTrim', 'StripTags'))); $smtpUsername = $this->createElement('text', 'smtp_username', array('label' => $view->getTranslation('SMTP username'), 'value' => $settings->smtp_username, 'belongsTo' => 'setting', 'filters' => array('StringTrim', 'StripTags'))); $smtpPassword = $this->createElement('password', 'smtp_password', array('label' => $view->getTranslation('SMTP password'), 'value' => $settings->smtp_password, 'belongsTo' => 'setting', 'filters' => array('StringTrim'))); $mailTest = $this->createElement('AnyMarkup', 'mail_test', array('value' => $view->link($view->getTranslation('Send test message'), '/admin/site/mail-test', 'email_go.png'), 'decorators' => $this->getStandardDecorator('text'))); $mailSubmit = $this->createElement('submit', 'mail', array('label' => $view->getTranslation('Update Mail Settings'), 'attribs' => array('class' => 'submit'))); $this->addElement($defaultEmail)->addElement($defaultEmailSender)->addElement($useSmtpMail)->addElement($smtpHost)->addElement($smtpUsername)->addElement($smtpPassword)->addElement($mailTest)->addElement($mailSubmit); $group = $this->addDisplayGroup(array('form_instance', 'default_email', 'default_email_sender', 'use_smtp_mail', 'smtp_host', 'smtp_username', 'smtp_password', 'mail_test', 'mail'), 'mailGroup', array('legend' => $view->getTranslation('Mail Settings'))); /* ********************************************************************* * GOOGLE INTEGRATION * ****************************************************************** */ $googleVerify = $this->createElement('textarea', 'google_verify', array('label' => $view->getTranslation('Verification code'), 'value' => $settings->google_verify, 'belongsTo' => 'setting', 'attribs' => array('class' => 'med'), 'filters' => array('StringTrim', 'StripTags'))); $googleTracking = $this->createElement('textarea', 'google_tracking', array('label' => $view->getTranslation('Tracking code'), 'value' => $settings->google_tracking, 'belongsTo' => 'setting', 'attribs' => array('class' => 'med'), 'filters' => array('StringTrim', 'StripTags'))); $googleSubmit = $this->createElement('submit', 'google', array('label' => $view->getTranslation('Update Google Settings'), 'attribs' => array('class' => 'submit'))); $this->addElement($googleVerify); $this->addElement($googleTracking); $this->addElement($googleSubmit); $this->addDisplayGroup(array('form_instance', 'google_verify', 'google_tracking', 'google'), 'googleGroup', array('legend' => $view->getTranslation('Google Integration'))); }
/** * Initialize the form * * @return void */ public function init() { parent::init(); $view = $this->getView(); $pathToMedia = $this->_getData('pathToMedia'); $mediaFolder = $this->_getData('mediaFolder'); $path = $this->_getData('path'); $filepath = $this->_getData('filepath'); $mediapath = $this->_getData('mediapath'); $files = $this->_getData('files'); $folders = $this->_getData('folders'); $folderPathParts = $this->_getData('folderPathParts'); $label = $this->_getData('label'); /* ********************************************************************* * CURRENT DIRECTORY * ****************************************************************** */ $pathParts[] = $pathToMedia; if (is_array($folderPathParts)) { foreach ($folderPathParts as $path2 => $label2) { $pathParts[] = '<a href="' . $view->getBaseUrl() . '/admin/media/open-folder/folder/' . $path2 . '">' . Digitalus_Toolbox_String::stripUnderscores($label2) . '</a>'; } } $xhtml = '<p>' . $view->getTranslation('Media Root') . implode('/', $pathParts) . '</p>'; $currentDirectory = $this->createElement('AnyMarkup', 'current_directory', array('value' => $xhtml, 'decorators' => $this->getStandardDecorator('none'))); /* ********************************************************************* * BROWSE * ****************************************************************** */ $siteRoot = $view->getBaseUrl() . '/'; $basePath = $siteRoot . $mediaFolder; if (!empty($filepath)) { $basePath .= '/' . $filepath; } $xhtml = ''; // DIRECTORIES if (is_array($folders) && count($folders) > 0) { $xhtml = '<h3>' . $view->getTranslation('Subfolders') . '</h3>'; foreach ($folders as $folder) { $folder = Digitalus_Toolbox_String::addUnderscores($folder); $cleanPath = Digitalus_Toolbox_String::stripHyphens($folder); $cleanPath = Digitalus_Toolbox_String::stripUnderscores($folder); $deleteLink = '/admin/media/delete-folder/folder/' . $mediapath . '_' . $folder; $path2 = '/admin/media/open-folder/folder/' . $mediapath . '_' . $folder; $xhtml .= '<div class="folderWrapper">' . ' ' . $view->link('Delete', $deleteLink, 'delete.png', 'rightLink delete') . ' <h4>' . $view->link($cleanPath, $path2, 'folder.png') . '</h4>' . ' <p>' . $view->getTranslation('Full path') . ': <code>' . $basePath . '/' . $cleanPath . '</code></p>' . '</div>'; } } // FILES if (is_array($files) && count($files) > 0) { $xhtml .= '<h3>' . $view->getTranslation('Files') . '</h3>'; foreach ($files as $file) { if (substr($file, 0, 1) != '.') { $filepath2 = Digitalus_Toolbox_String::stripUnderscores($basePath) . '/' . $file; $fileLink = $mediapath . '_' . $file; $deleteLink = '/admin/media/delete-file/file/' . $fileLink . '/'; $path2 = $mediaFolder . '/' . $filepath . $filepath2; $xhtml .= '<div class="fileWrapper">' . ' ' . $view->link('Delete', $deleteLink, 'delete.png', 'rightLink delete') . ' <h4>' . $view->link($file, $path2, $view->getIconByFiletype($filepath2, false)) . '</h4>' . ' <p>' . $view->getTranslation('Full path') . ': <code>' . $basePath . $filepath2 . '</code></p>' . '</div>'; } } } $subDirectories = $this->createElement('AnyMarkup', 'sub_directories', array('value' => $xhtml, 'decorators' => $this->getStandardDecorator('none'))); /* ********************************************************************* * UPLOAD * ****************************************************************** */ $filePath = $this->createElement('hidden', 'filepath', array('value' => $filepath, 'decorators' => $this->getStandardDecorator('none'))); $mediapath = $this->createElement('hidden', 'mediapath', array('value' => $mediapath, 'decorators' => $this->getStandardDecorator('none'))); $uploads = $this->createElement('file', 'uploads[]', array('label' => $view->getTranslation('Select the files to upload'), 'belongsTo' => 'uploads', 'attribs' => array('id' => 'multi_upload'), 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('File_NotExists', true, array())))); $uploadSubmit = $this->createElement('submit', 'uploadSubmit', array('label' => $view->getTranslation('Upload Files'), 'attribs' => array('class' => 'submit'))); /* ********************************************************************* * CREATE SUBFOLDER * ****************************************************************** */ $path = $this->createElement('hidden', 'path', array('value' => $path, 'decorators' => $this->getStandardDecorator('none'))); $folderName = $this->createElement('text', 'folder_name', array('required' => true, 'label' => $view->getTranslation('Folder Name'), 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('NotEmpty', true), array('Regex', true, array('pattern' => Digitalus_Media::MEDIALABEL_REGEX, 'messages' => array('regexNotMatch' => Digitalus_Media::MEDIALABEL_REGEX_NOTMATCH)))))); $createFolderSubmit = $this->createElement('submit', 'createFolderSubmit', array('label' => $view->getTranslation('Create Folder'), 'attribs' => array('class' => 'submit'))); /* ********************************************************************* * RENAME FOLDER * ****************************************************************** */ $newName = $this->createElement('text', 'new_folder_name', array('required' => true, 'label' => $view->getTranslation('New Name'), 'value' => $label, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('NotEmpty', true), array('Regex', true, array('pattern' => Digitalus_Media::MEDIALABEL_REGEX, 'messages' => array('regexNotMatch' => Digitalus_Media::MEDIALABEL_REGEX_NOTMATCH)))))); $renameFolderSubmit = $this->createElement('submit', 'renameFolderSubmit', array('label' => $view->getTranslation('Rename Folder'), 'attribs' => array('class' => 'submit'))); /* ********************************************************************* * PUT IT ALL TOGETHER * ****************************************************************** */ $this->addElement($currentDirectory); $this->addElement($subDirectories); $this->addElement($filePath); $this->addElement($mediapath); $this->addElement($uploads); $this->addElement($path); $this->addElement($folderName); $this->addElement($newName); $this->addElement($uploadSubmit); $this->addElement($createFolderSubmit); $this->addElement($renameFolderSubmit); $this->addDisplayGroup(array('form_instance', 'filepath', 'mediapath', 'current_directory'), 'mediaCurrentGroup', array('legend' => $view->getTranslation('Current Folder'))); $this->addDisplayGroup(array('sub_directories'), 'mediaSubDirectoriesGroup', array('legend' => $view->getTranslation('Current folder contents'))); $this->addDisplayGroup(array('uploads', 'uploadSubmit'), 'mediaUploadGroup', array('legend' => $view->getTranslation('Upload Files'))); $this->addDisplayGroup(array('path', 'folder_name', 'createFolderSubmit'), 'mediaCreateFolderGroup', array('legend' => $view->getTranslation('Create Subfolder'))); $this->addDisplayGroup(array('new_folder_name', 'renameFolderSubmit'), 'mediaRenameFolderGroup', array('legend' => $view->getTranslation('Rename Folder'))); }