/** * gets the parameters list */ function _getParams($module) { $toReturn = array(); CopixContext::push($module); foreach (CopixConfig::getParams($module) as $params) { $params['Caption'] = CopixI18N::get($params['Caption']); $toReturn[] = $params; } CopixContext::pop(); return $toReturn; }
/** * Applique les changements sur le paramètre */ public function processValid() { CopixRequest::assert('idFirst', 'idSecond', 'value'); // si la config existe bien if (CopixConfig::exists(CopixRequest::get('idFirst') . '|' . CopixRequest::get('idSecond'))) { // initialisation de variables $id = CopixRequest::get('idFirst') . '|' . CopixRequest::get('idSecond'); $params = CopixConfig::getParams(CopixRequest::get('idFirst')); $config = $params[$id]; $value = CopixRequest::get('value'); $error = false; // type int if ($config['Type'] == 'int') { // chiffre invalide if ((string) intval($value) != (string) $value) { $error = 'typeInt'; // chiffre trop petit } elseif (!is_null($config['MinValue']) && $config['MinValue'] > intval($value)) { $error = 'typeIntMin'; // chiffre trop grand } elseif (!is_null($config['MaxValue']) && $config['MaxValue'] < intval($value)) { $error = 'typeIntMax'; } // type email } elseif ($config['Type'] == 'email') { // email invalide try { CopixFormatter::getMail($value); } catch (CopixException $e) { $error = 'typeEmail'; } // e-mail trop long if (!is_null($config['MaxLength']) && strlen($value) > $config['MaxLength']) { $error = 'typeEmailMax'; } // type text } elseif ($config['Type'] == 'text') { // texte trop long if (!is_null($config['MaxLength']) && strlen($value) > $config['MaxLength']) { $error = 'typeTextMax'; } } // si il y a eu une erreur if ($error !== false) { return _arRedirect(_url('admin|parameters|', array('choiceModule' => CopixRequest::get('choiceModule'), 'editParam' => CopixRequest::get('idSecond'), 'error' => $error))); } // modification de la config CopixConfig::set($id, $value); } return _arRedirect(_url('admin|parameters|', array('choiceModule' => CopixRequest::get('choiceModule')))); }
public function newMail() { $monMail = array(); $arrParametres = CopixConfig::getParams('default'); foreach ($arrParametres as $oneParam) { if ($oneParam['Name'] == 'mailFrom') { try { $monMail['from'] = CopixFormatter::getMail($oneParam['Value']); } catch (CopixException $e) { $monMail['from'] = null; } } elseif ($oneParam['Name'] == 'mailFromName') { $monMail['fromname'] = $oneParam['Value']; } } $monMail['dest'] = null; $monMail['cc'] = null; $monMail['cci'] = null; $monMail['subject'] = _i18n('email.title'); $monMail['msg'] = _i18n('email.message'); return $monMail; }
/** * gets the parameters for a given module * @return array */ function getParameters($moduleName) { if (CopixModule::isValid($moduleName)) { return CopixConfig::getParams($moduleName); } return array(); }
/** * gets the parameters for a given module * @return array */ public static function getParameters($moduleName) { if (self::isValid($moduleName)) { return CopixConfig::getParams($moduleName); } return array(); }