本文整理汇总了PHP中AppConfig::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP AppConfig::populate方法的具体用法?PHP AppConfig::populate怎么用?PHP AppConfig::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppConfig
的用法示例。
在下文中一共展示了AppConfig::populate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterUpdate
function afterUpdate()
{
$session = SessionWrapper::getInstance();
# check if user is being invited during update
if (!isEmptyString($this->getDefaultUserID()) && isEmptyString($this->getDefaultUser()->getCompanyID())) {
$this->getDefaultUser()->setCompanyID($this->getID());
$startdate = DEFAULT_DATETIME;
$expirydate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($startdate)) . " +" . getTrialDays() . " days "));
if (isEmptyString($this->getStartDate()) && $this->getID() != DEFAULT_COMPANYID) {
$this->setStartDate($startdate);
}
if (isEmptyString($this->getEndDate()) && $this->getID() != DEFAULT_COMPANYID) {
$this->setEndDate($expirydate);
}
$this->save();
}
// invite via email
if ($this->getIsBeinginvited() == 1) {
$this->getDefaultUser()->inviteViaEmail();
}
if ($this->getID() == DEFAULT_ID) {
$config_collection = new Doctrine_Collection(Doctrine_Core::getTable("AppConfig"));
$appconfig = new AppConfig();
$appconfig->populate(61);
$appconfig->setOptionValue($this->getAppName());
$config_collection->add($appconfig);
$appconfig = new AppConfig();
$appconfig->populate(62);
$appconfig->setOptionValue($this->getName());
$config_collection->add($appconfig);
if ($config_collection->count() > 0) {
$config_collection->save();
}
}
return true;
}
示例2: processglobalconfigAction
function processglobalconfigAction()
{
$session = SessionWrapper::getInstance();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$formvalues = $this->_getAllParams();
$successurl = decode($formvalues[URL_SUCCESS]);
// debugMessage($formvalues);
$postarray = array();
for ($i = 1; $i <= $formvalues['t']; $i++) {
$postarray[$i]['id'] = $formvalues['id_' . $i];
$postarray[$i]['displayname'] = $formvalues['displayname_' . $i];
$postarray[$i]['optionvalue'] = $formvalues['optionvalue_' . $i];
}
$config_collection = new Doctrine_Collection(Doctrine_Core::getTable("AppConfig"));
foreach ($postarray as $line) {
$appconfig = new AppConfig();
$appconfig->populate($line['id']);
$appconfig->processPost($line);
/*debugMessage('error is '.$appconfig->getErrorStackAsString());
debugMessage($appconfig->toArray());*/
if ($appconfig->isValid()) {
$config_collection->add($appconfig);
}
}
// check for atleast one option and save
if ($config_collection->count() > 0) {
try {
// debugMessage($config_collection->toArray());
$config_collection->save();
$session->setVar(SUCCESS_MESSAGE, $formvalues[SUCCESS_MESSAGE]);
# clear cache after updating options
$temppath = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR;
// debugMessage($temppath);
$files = glob($temppath . 'zend_cache---config*');
foreach ($files as $file) {
debugMessage($file);
if (is_file($file)) {
unlink($file);
}
}
} catch (Exception $e) {
$session->setVar(ERROR_MESSAGE, "An error occured in updating the parameters. " . $e->getMessage());
}
}
// debugMessage($successurl);
$this->_helper->redirector->gotoUrl($successurl);
// exit();
}