opt = $opt; if ($this->opt['edit_only']){ unset($this->actions['new']); unset($this->actions['del']); unset($this->actions['insert']); } $this->DB_Grid($Doc, $DBObj); } function _getBaseForm($method = 'post') { $form = SiteMap::getObj('FormMail/Grid/FMGridForm.php', &$this->Doc, '', $method); return $form; } function doBack() { if ($_REQUEST['submit']['gotoflds']){ require_once 'class/HTTP.php'; skHTTP::redirect(Constant::get('BASE_URL').'/'.CURR_PAGE.'/field?id_fm='.$this->DBObj->id); }else { parent::doBack(); } return true; } function _bindFormFields($form) { $form = parent::_bindFormFields($form); $form->addRule('subject', 'Subject is required', 'required', null, 'client'); $form->addRule('subject', 'Subject is required', 'required'); $form->addRule('email_to', 'To e-mail is required', 'required', null, 'client'); $form->addRule('email_to', 'To e-mail is required', 'required'); $regex_mail = '((\"[^\,\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))'; $regex = "/^($regex_mail)(\s*\,\s*($regex_mail))*\s*\,?$/"; $form->addRule('email_to', 'To e-mail invalid', 'regex', $regex, 'client'); $form->addRule('email_to', 'To e-mail invalid', 'regex', $regex); $form->addRule('email_from', 'From e-mail invalid', 'email', null, 'client'); $form->addRule('email_from', 'From e-mail invalid', 'email'); $form->addRule('email_from', 'From e-mail is required', 'required', null, 'client'); $form->addRule('email_from', 'From e-mail is required', 'required'); require_once 'class/DB/Lang/DLang.php'; $DLang = new DLang(); $langList = $DLang->getList(); if (count($langList) > 1){ $form->addElement('header', 'title_header', 'Title'); } foreach ($DLang->getList() as $lang){ $name = "title[{$lang['name']}]"; if (count($langList) == 1){ $title = 'Title'; }else{ $title = $lang['title']; } $form->addElement('text', $name, $title, array('value' => $this->DBObj->getData($name) ) ); } $this->DBObj->getFromDB($this->DBObj->id); if (in_array('frm_tpl', $this->DBObj->thankMsg->fieldsCont) ){ if (count($langList) > 1){ $form->addElement('header', 'frm_tpl', 'Form instructions'); } foreach ($DLang->getList() as $lang){ $name = "frm_tpl[{$lang['name']}]"; if (count($langList) == 1){ $title = 'Form instructions'; }else{ $title = $lang['title']; } $form->addElement('html_editor', $name, $title, null, $this->DBObj->getData($name)); } } if (count($langList) > 1){ $form->addElement('header', 'thank_header', 'Thank message'); } foreach ($DLang->getList() as $lang){ $name = "thank_msg[{$lang['name']}]"; if (count($langList) == 1){ $title_error = 'Thank message is required'; $title = 'Thank message'; }else{ $title_error = $lang['title'] . ' thank message is required'; $title = $lang['title']; } $form->addElement('html_editor', $name, $title, null, $this->DBObj->getData($name) ); $form->addRule($name, $title_error, 'required'); } return $form; } function _doListBind(&$DB_List) { $DB_List->bind(); $DB_List->removeCol('email_from'); $fields = array('title' => 'Fields', 'width' => 100, 'tpl' => DB_LIST_CELL_LINK, 'params' => array('id'), 'empty_title' => 'Fields', 'url' => Constant::get('BASE_URL').'/'. CURR_PAGE.'/field?id_fm=', ); $DB_List->insertColBefore('fields', $fields,'options'); $fields = array('title' => 'Submissions', 'width' => 100, 'tpl' => DB_LIST_CELL_LINK, 'params' => array('id', 'req_cnt'), 'empty_title' => 'No Submissions', 'url' => Constant::get('BASE_URL').'/'. CURR_PAGE.'/submissions?id_fm=', ); $DB_List->insertColBefore('submissions', $fields,'options'); if ($this->opt['edit_only']){ $DB_List->updateCol('options', 'tpl', DB_LIST_CELL_EDIT); } return true; } function addLink() { if ($this->opt['edit_only']){ return null; }else { return parent::addLink(); } } function doEdit() { Session::setData(CURR_PAGE, 'back_path', Constant::get('BASE_URL').'/'.CURR_PAGE.'?'.$_SERVER['QUERY_STRING']); parent::doEdit(); } function doList() { Session::setData(CURR_PAGE, 'back_path', Constant::get('BASE_URL').'/'.CURR_PAGE.'?'.$_SERVER['QUERY_STRING']); parent::doList(); } } ?>