Exemplo n.º 1
0
 public function testIsRequired()
 {
     $this->form->addElement('textarea')->setName('Textarea-A')->setRequired();
     $formelement = $this->form->getElementByName('Textarea-A');
     $this->assertTrue($formelement->required);
     $this->assertTrue($formelement->isRequired());
 }
 public function action_admin_settings()
 {
     // Set Pagetitle and Breadcrumbs
     Clansuite_Breadcrumb::add(_('Settings'), '/statistics/admin/settings');
     $settings = array();
     $settings['form'] = array('name' => 'statistic_settings', 'method' => 'POST', 'action' => '/statistics/admin/settings_update');
     $settings['statistics'][] = array('id' => 'deleteTimeWho', 'name' => 'deleteTimeWho', 'label' => 'delete Time', 'description' => _('Delete time of old database entries for the WhoIsOnline table. Value in days. After x days delete old entries !'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('deleteTimeWho', '1'));
     $settings['statistics'][] = array('id' => 'timoutWho', 'name' => 'timoutWho', 'label' => 'Online Timeout', 'description' => _('Defines the timeout for a user or guest. Value in minutes.'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('timoutWho', '5'));
     // fill the settings array into the formgenerator
     $form = new Clansuite_Form($settings);
     // add additional buttons to the form
     $form->addElement('submitbutton')->setName('Save');
     $form->addElement('resetbutton');
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
 public function action_admin_list()
 {
     // fetch modulenames as numeric indexed array
     $modules = Clansuite_ModuleInfoController::getModuleNames(false, true);
     $themes = Clansuite_Theme::getThemeDirectories();
     // create a new form
     $form = new Clansuite_Form('module_select_dropdown_form', 'post', '/templatemanager/admin/edit');
     $form->setLegend(_('Select Module or Theme to edit'));
     // select dropdown for modules
     $form->addElement('select')->setName('select_form[module]')->setLabel(_('Module'))->setOptions($modules)->withValuesAsKeys();
     // select dropdown for themes
     $form->addElement('select')->setName('select_form[theme]')->setLabel(_('Theme'))->setOptions($themes)->withValuesAsKeys();
     // add the buttonbar
     $form->addElement('buttonbar')->setCancelButtonURL('index.php?mod=templatemanager&sub=admin');
     // assign the html of the form to the view
     $this->getView()->assign('module_select_dropdown_form', $form->render());
     $this->display();
 }
 public function action_settings()
 {
     // Set Pagetitle and Breadcrumbs
     Clansuite_Breadcrumb::add(_('Settings'), '/controlcenter/admin/settings');
     $settings = array();
     $settings['form'] = array('name' => 'controlcenter_settings', 'method' => 'POST', 'action' => '/controlcenter/settings_update');
     $settings['controlcenter'][] = array('id' => 'show_box_shortcuts', 'name' => 'show_box_shortcuts', 'description' => _('Show Shortcuts'), 'formfieldtype' => 'selectyesno', 'value' => self::getConfigValue('show_box_shortcuts', '1'));
     $settings['controlcenter'][] = array('id' => 'show_box_news', 'name' => 'show_box_news', 'description' => _('Show News'), 'formfieldtype' => 'selectyesno', 'value' => self::getConfigValue('show_box_news', '1'));
     $settings['controlcenter'][] = array('id' => 'show_box_security', 'name' => 'show_box_security', 'description' => _('Show Security'), 'formfieldtype' => 'selectyesno', 'value' => self::getConfigValue('show_box_security', '1'));
     $settings['controlcenter'][] = array('id' => 'show_box_extensions', 'name' => 'show_box_extensions', 'description' => _('Show Extensions'), 'formfieldtype' => 'selectyesno', 'value' => self::getConfigValue('show_box_extensions', '1'));
     $form = new Clansuite_Form($settings);
     // display formgenerator object
     #Clansuite_Debug::printR($form);
     $form->addElement('submitbutton')->setName('Save');
     $form->addElement('resetbutton');
     // display form html
     #Clansuite_Debug::printR($form->render());
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
Exemplo n.º 5
0
 public function action_admin_modulemenueditor()
 {
     $modulenames = Clansuite_ModuleInfoController::getModuleNames(false, true);
     // create a new form
     $form = new Clansuite_Form('module_select_dropdown_form', 'post', '/menu/admin/modulemenu_edit');
     // select dropdown for modules
     $form->addElement('select')->setName('menu_select_form[modulename]')->setLabel(_('Module'))->setOptions($modulenames);
     // add the buttonbar
     $form->addElement('buttonbar')->getButton('cancelbutton')->setCancelURL('index.php?mod=menu&sub=admin');
     // assign the html of the form to the view
     $this->getView()->assign('module_select_dropdown_form', $form->render());
     $this->display();
 }
Exemplo n.º 6
0
 /**
  * Edit News
  *
  * @todo autoloader/di for forms
  */
 public function action_admin_edit()
 {
     // get id
     $news_id = $this->request->getParameter('id');
     // fetch news data by id
     $news = $this->getModel()->fetchSingleNews($news_id);
     // create a new form
     $form = new Clansuite_Form('news_form', 'post', 'index.php?mod=news&sub=admin&action=update&type=edit');
     $form->setLegend('News Editor')->setClass('News');
     // news_id as hidden field
     $form->addElement('hidden')->setName('news_form[news_id]')->setValue($news['news_id']);
     // user_id as hidden field
     $form->addElement('hidden')->setName('news_form[user_id]')->setValue($news['user_id']);
     $form->addElement('text')->setName('news_form[news_title]')->setLabel(_('Title'))->setValue($news['news_title']);
     $categories = $this->getModel()->fetchAllNewsCategoriesDropDown();
     $form->addElement('multiselect')->setName('news_form[cat_id]')->setLabel(_('Category'))->setOptions($categories)->setDefaultValue($news['cat_id']);
     $form->addElement('multiselect')->setName('news_form[news_status]')->setLabel(_('Status'))->setOptions($this->publishing_status_map)->setDefaultValue($news['news_status']);
     $form->addElement('textarea')->setName('news_form[news_body]')->setID('news_form[news_body]')->setCols('30')->setRows('12')->setLabel(_('Your Article:'))->setValue($news['news_body'])->setEditor();
     // add the buttonbar
     $form->addElement('buttonbar')->getButton('cancelbutton')->setCancelURL('index.php?mod=news/admin');
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
 public function action_admin_settings()
 {
     // Set Pagetitle and Breadcrumbs
     Clansuite_Breadcrumb::add(_('Settings'), '/categories/admin/settings');
     $settings = array();
     $settings['form'] = array('name' => 'categories_settings', 'method' => 'POST', 'action' => '/categories/admin/settings_update');
     $settings['categories'][] = array('id' => 'items_resultsPerPage', 'name' => 'items_resultsPerPage', 'label' => _('Categories per Page'), 'description' => _('Categories per Page'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('items_resultsPerPage', '25'));
     $form = new Clansuite_Form($settings);
     // display formgenerator object
     #Clansuite_Debug::printR($form);
     $form->addElement('submitbutton')->setName('Save');
     $form->addElement('resetbutton');
     // display form html
     #Clansuite_Debug::printR($form->render());
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
 /**
  *
  */
 public function action_admin_new()
 {
     Clansuite_Breadcrumb::add(_('Add language'), '/languages/admin/new');
     // handle get request
     if ($this->request->getRequestMethod() == 'GET') {
         $module = $this->request->getParameter('modulename', 'GET');
         $form = new Clansuite_Form('languages_dropdown', 'post', WWW_ROOT . 'index.php?mod=languages&sub=admin&action=new');
         $form->setLegend(_('Select the language to add'));
         // $_POST['locale']
         $form->addElement('selectlocale')->setDescription('Use the dropdown to select a locale by name or abbreviation.');
         // $_POST['module']
         $form->addElement('hidden')->setName('module')->setValue($module);
         $form->addElement('buttonbar');
         $view = $this->getView();
         $view->assign('modulename', $module);
         $view->assign('form_languages_dropdown', $form->render());
         $this->display();
     }
 }
Exemplo n.º 9
0
 public function action_admin_settings()
 {
     // Set Pagetitle and Breadcrumbs
     Clansuite_Breadcrumb::add(_('Settings'), '/forum/admin/settings');
     $settings = array();
     $settings['form'] = array('name' => 'forum_settings', 'method' => 'POST', 'action' => '/forum/admin/settings_update');
     $settings['forum'][] = array('id' => 'list_max', 'name' => 'list_max', 'description' => _('list_max'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('list_max', '30'));
     $settings['forum'][] = array('id' => 'char_max', 'name' => 'char_max', 'description' => _('Maximum Textcharacter'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('char_max', '999'));
     $settings['forum'][] = array('id' => 'allow_bb_code', 'name' => 'allow_bb_code', 'description' => _('Allow BBCode'), 'formfieldtype' => 'selectyesno', 'value' => array('selected' => self::getConfigValue('allow_bb_code', '1')));
     $settings['forum'][] = array('id' => 'allow_html', 'name' => 'allow_html', 'description' => _('Allow HTML'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('allow_html', '0'));
     $settings['forum'][] = array('id' => 'allow_geshi_highlight', 'name' => 'allow_geshi_highlight', 'description' => _('Allow Geshi Highlighting'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('allow_geshi_highlight', '1'));
     $form = new Clansuite_Form($settings);
     // display formgenerator object
     #Clansuite_Debug::printR($form);
     $form->addElement('submitbutton')->setName('Save');
     $form->addElement('resetbutton');
     // display form html
     #Clansuite_Debug::printR($form->render());
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
Exemplo n.º 10
0
 /**
  * Action for displaying the Settings of a Module Users
  */
 public function action_admin_settings()
 {
     // Set Pagetitle and Breadcrumbs
     Clansuite_Breadcrumb::add(_('Settings'), '/users/admin/settings');
     $settings = array();
     $settings['form'] = array('name' => 'users_settings', 'method' => 'POST', 'action' => '/users/admin/settings_update');
     $settings['users'][] = array('id' => 'items_lastregisteredusers', 'name' => 'items_lastregisteredusers', 'label' => 'Label', 'description' => _('How many Last Users'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('items_lastregisteredusers', '4'));
     $form = new Clansuite_Form($settings);
     $form->addElement('submitbutton')->setName('Save');
     $form->addElement('resetbutton');
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
Exemplo n.º 11
0
 public function action_admin_settings()
 {
     // Set Pagetitle and Breadcrumbs
     Clansuite_Breadcrumb::add(_('Settings'), '/account/admin/settings');
     $settings = array();
     $settings['form'] = array('name' => 'account_settings', 'method' => 'POST', 'action' => '/account/admin/settings_update');
     $settings['account'][] = array('id' => 'resultsPerPage_show', 'name' => 'resultsPerPage_show', 'label' => 'Newsitems', 'description' => _('Newsitems to show in Newsmodule'), 'formfieldtype' => 'text', 'value' => self::getConfigValue('resultsPerPage_show', '3'));
     $form = new Clansuite_Form($settings);
     #Clansuite_Debug::printR($form);
     $form->addElement('submitbutton')->setName('Save');
     $form->addElement('resetbutton');
     // display form html
     #Clansuite_Debug::printR($form->render());
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }
Exemplo n.º 12
0
 /**
  *  form to edit userpic
  */
 public function action_profile_edit_userpic()
 {
     // get id
     #$user_id = $this->request->getParameter('id');
     $user_id = 2;
     // fetch userdata
     $data = Doctrine::getTable('CsUsers')->fetchSingleUserData($user_id);
     // Create a new form
     // @todo form object with auto-population of values
     $form = new Clansuite_Form('userpic_form', 'post', '/account&sub=profile&action=update&type=edituserpic');
     /**
      * user_id as hidden field
      */
     $form->addElement('hidden')->setName('userpic_form[user_id]')->setValue($data['user_id']);
     // Assign some formlements
     $form->addDecorator('fieldset')->setLegend('Edit your User-Picture');
     $form->addGroup('userpic');
     $form->addElement('jquploadify')->addToGroup('userpic')->setName('userpic_form[userpic]')->setLabel(_('Upload your User-Picture:'))->setDescription('max. 150x150px and max 1Mb');
     $form->addElement('submitbutton')->setValue('Submit');
     $form->addElement('resetbutton')->setValue('Reset');
     $form->addElement('cancelbutton');
     // Debugging Form Object
     #Clansuite_Debug::printR($form);
     // Debugging Form HTML Output
     #Clansuite_Debug::printR($form->render());
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }