public function setDefaultOptionsFromSite(SiteModel $site) { if ($site->getIsFeaturePhysicalEvents() && !$site->getIsFeatureVirtualEvents()) { $this->is_physical = true; $this->is_virtual = false; } else { if (!$site->getIsFeaturePhysicalEvents() && $site->getIsFeatureVirtualEvents()) { $this->is_physical = false; $this->is_virtual = true; } } }
public function settingsAction() { if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN) { CApp::setTitle(CApp::getAppName() . " | " . CApp::getTranslate('settings')); $arrResult = CApp::getSettingsArray(); if (!empty($_POST["SETTINGS"])) { $settingsArray = array(); foreach ($_POST["SETTINGS"] as $key => $value) { $settingsArray[$key] = filterGetValue($value); } $model = new SiteModel(); $arrResult = $model->update($settingsArray); } $this->render("settings", "site", $arrResult); } else { CApp::redirect("/"); } }
public function url_friendly($data) { return parent::url_friendly_process($data); }
/** * 保存环境信息 */ private function saveInfo() { $data = array('id' => (int) $_POST['id'], 'description' => $_POST['description'], 'modules' => $_POST['modules']); $model = new SiteModel(); if ($model->updateSite($data)) { show_json(); } else { show_error('保存出错!'); } }
public function GetSiteInfo() { $this->people_cout = parent::PeopleCountProcess(); $this->search_cout = parent::SearchLogCountProcess(); }
$site = ORM::forTable('sites')->findOne($_SESSION['siteid']); // print_r($site); $data['user'] = $user; $data['site'] = $site; } else { if ($navid == 'password') { } } } $app->render("console/setting/{$navid}.html", $data); })->name('setting'); $app->post('/setting/(:navid)', function ($navid = 'theme') use($app) { $req = $app->request(); if ($navid == 'theme') { $theme = $req->post('theme'); SiteModel::siteMeta($_SESSION['siteid'], 'theme', $theme); $app->flash('info', "主题'{$theme}'设置成功!"); } else { if ($navid == 'account') { $name = $req->post('name'); $app->flash('info', '保存成功' . $name); if ($name) { $user = ORM::forTable('users')->findOne($_SESSION['uid']); $user->nick = $name; $user->save(); } } else { if ($navid == 'password') { $user = ORM::forTable('users')->findOne($_SESSION['uid']); $oldpass = $req->post('old_password'); $newpass = $req->post('new_password');
/** * 修改状态 * * */ public function statusAction() { $id = $this->getg('id', 0); if (empty($id)) { $this->error('id 不能为空!'); } $status = $this->getg('status', 0); $status = $status ? 0 : 1; // 实例化Model $site = new SiteModel(); $row = $site->update(array('id' => $id), array('status' => $status)); if ($row) { $this->error('恭喜,操作成功', 'Message'); } else { $this->error('操作失败'); } }
public function getPromptEmailData(SiteModel $site, EventModel $lastEvent = null) { global $CONFIG; $moreEventsNeeded = false; $checkTime = \TimeSource::getDateTime(); if ($lastEvent) { $dateInterval = new \DateInterval("P" . $site->getPromptEmailsDaysInAdvance() . "D"); $endTimeMinusExtra = clone $lastEvent->getEndAt(); $endTimeMinusExtra->sub($dateInterval); if ($endTimeMinusExtra < $checkTime) { // there is a last event and it is before now plus whenever! // Now check; have we notified the user of this before? $dateSince = $this->getSinceDateForPromptChecking(); if ($endTimeMinusExtra > $dateSince) { // Finally check: has safe gap passed where we only send one email every X days? $safeGapDays = max($site->getPromptEmailsDaysInAdvance(), $CONFIG->userWatchesPromptEmailSafeGapDays); $nowMinusSafeGap = \TimeSource::getDateTime(); $nowMinusSafeGap->sub(new \DateInterval("P" . $safeGapDays . "D")); if ($dateSince < $nowMinusSafeGap) { // Finally we can agree to send an alert! $moreEventsNeeded = true; } } } } // TODO when add importing, need to double check this. return array('moreEventsNeeded' => $moreEventsNeeded, 'checkTime' => $checkTime); }