本文整理汇总了PHP中UserSettings类的典型用法代码示例。如果您正苦于以下问题:PHP UserSettings类的具体用法?PHP UserSettings怎么用?PHP UserSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getNavigation
public static function getNavigation($callerBadgerRoot)
{
global $badgerDb;
NavigationFromDB::$callerBadgerRoot = $callerBadgerRoot;
$settings = new UserSettings($badgerDb);
$itemTypes = array('i' => 'item', 'm' => 'menu', 's' => 'separator');
$sql = 'SELECT navi_id, parent_id, menu_order, item_type, item_name, tooltip, icon_url, command
FROM navi
ORDER BY parent_id, menu_order';
$res =& $badgerDb->query($sql);
$menus = array();
$row = array();
while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) {
$menuId = $row['parent_id'];
//create containing menu if it does not exist
if (!isset($menus[$menuId])) {
$menus[$menuId] = array();
}
//fill most of the fields
$menus[$menuId][] = array('type' => $itemTypes[$row['item_type']], 'name' => getBadgerTranslation2("Navigation", $row['item_name']), 'tooltip' => $row['tooltip'], 'icon' => BADGER_ROOT . "/tpl/" . $settings->getProperty("badgerTemplate") . "/Navigation/" . $row['icon_url'], 'command' => NavigationFromDB::replaceBadgerRoot($row['command']));
//if current row is a menu
if ($row['item_type'] == 'm') {
//create sub-menu if it does not exist
if (!isset($menus[$row['navi_id']])) {
$menus[$row['navi_id']] = array();
}
//add menu field to the previously created item and assign a reference to the proper
//sub-menu to it
$menus[$menuId][count($menus[$menuId]) - 1]['menu'] =& $menus[$row['navi_id']];
}
}
//All sub-menus are within element 0 as references
return $menus[0];
}
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:34,代码来源:NavigationFromDB.class.php
示例2: executesetcountry
public function executesetcountry($eventData)
{
$userCfg = new UserSettings(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getUserId());
$userCfg->setKey('desktop-country', $eventData['country']);
$domainSettings = new DomainSettings(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess());
if (User::isAdminUser(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getUserName(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDomainId())) {
$domainSettings->EditKey('desktop-country', $eventData['country']);
}
$this->status = $this->localeCatalog->getStr('countryset_status');
$this->setChanged();
$this->notifyObservers('status');
$this->notifyObservers('javascript');
}
开发者ID:innomatic,项目名称:innomatic-legacy,代码行数:13,代码来源:InterfacePanelActions.php
示例3: Send
public function Send($users, $data = false, $templatetype = false, $subject = false, $message = false)
{
$nt = NotifyTemplate::getInstance();
//$ntdata = $nt->FetchData($templateid);
$us = UserSettings::getInstance();
$setting = Settings::getInstance();
$nm = NotificationModule::getInstance();
$user = User::getInstance();
$lang = Lang::getInstance();
for ($i = 0; $i < count($users); $i++) {
$usersettings = $us->Get($users[$i]['id']);
if (@$usersettings[$templatetype] != "0") {
if (is_numeric($usersettings['language'])) {
$langdata = $lang->FetchData($usersettings['language']);
$langcode = $langdata['code'];
} else {
$langcode = $setting->Get('system.lang.default');
}
if (strlen($langcode) != 2) {
throw new Exception("Lang code not found or in wrong format");
}
if (is_array($data) && $templatetype != '' && $templatetype != false) {
if (!is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = '" . $langcode . "'")) && !is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = 'en'"))) {
throw new Exception("Notify Template not found with type " . $templatetype . " and language " . $langcode);
}
$ntdata = $nt->FetchData($templateid);
if (!is_array($ntdata)) {
continue;
}
$message = $this->prepare_template($ntdata['text'], $data);
} elseif (is_string($subject) && is_string($message)) {
$ntdata['subject'] = $subject;
} else {
throw new Exception("Wrong parameters specified");
}
if (is_numeric($usersettings['notifymodule']) && is_string($usersettings['notifyaddress'])) {
$moduleid = $usersettings['notifymodule'];
$address = $usersettings['notifyaddress'];
} else {
$userdata = $user->FetchData($users[$i]['id']);
$moduleid = $setting->Get('system.notifymodule.default');
$address = $userdata['email'];
}
if (strlen($address) < 2 || !is_numeric($moduleid)) {
continue;
}
if ($nm->Send($moduleid, $address, $ntdata['subject'], $message)) {
$status = 'Done';
} else {
$status = 'Fail';
}
$this->Create(array('userid' => $users[$i]['id'], 'moduleid' => $moduleid, 'subject' => $ntdata['subject'], 'text' => $message, 'address' => $address, 'status' => $status));
} else {
return true;
}
}
return true;
}
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:58,代码来源:class.Notification.php
示例4: generateAddTaskBlock
/**
* A custom method within the Plugin to generate the content
*
* @return string : HTML
* @see class/UserSettings.class.php
* @see class/DiscussionEmailSetting.class.php
*/
function generateAddTaskBlock()
{
$output = '';
$idproject = $_SESSION["do_project"]->idproject;
if (!is_object($_SESSION['UserSettings'])) {
$do_user_settings = new UserSettings();
$do_user_settings->sessionPersistent("UserSettings", "logout.php", OFUZ_TTL);
}
$data = $_SESSION['UserSettings']->getSettingValue("task_discussion_alert");
$global_discussion_email_on = 'Yes';
if (!$data) {
$global_discussion_email_on = 'Yes';
} else {
if (is_array($data)) {
if ($data["setting_value"] == 'Yes') {
$global_discussion_email_on = 'Yes';
} else {
$global_discussion_email_on = 'No';
}
}
}
$_SESSION['UserSettings']->global_task_discussion_alert = $global_discussion_email_on;
if ($global_discussion_email_on == 'Yes') {
$DiscussionEmailSetting = new DiscussionEmailSetting();
$data = $DiscussionEmailSetting->isDiscussionAlertSet($idproject, 'Project');
if ($data && is_array($data)) {
$output .= _('You have turned off email alert for this project.<br /> If you want to get email alerts for this project please turn it on. <br />');
$set_email_alert_on = new Event("DiscussionEmailSetting->eventSetOnDiscussionAlert");
$set_email_alert_on->addParam("setting_level", "Project");
$set_email_alert_on->addParam("id", $data["iddiscussion_email_setting"]);
$output .= '<br />';
$output .= $set_email_alert_on->getLink('Turn On');
} else {
$output .= _('Your email alert for the project discussion is set on by default. You can turn off if you do not want to receive emails for this project discussion.<br />');
$set_email_alert_off = new Event("DiscussionEmailSetting->eventSetOffDiscussionAlert");
$set_email_alert_off->addParam("id", $idproject);
$set_email_alert_off->addParam("setting_level", "Project");
$output .= '<br />';
$output .= $set_email_alert_off->getLink('Turn Off');
}
}
return $output;
}
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:50,代码来源:ProjectDiscussionEmailAlertBlock.class.php
示例5: create
/**
* Creates a new overview event.
*
* @param int ovent type id
* @param int time
* @param mixed event id (may be null)
* @param int relational id
* @param array additional fields
* @param bool checked
* @param mixed data
* @return Ovent
*/
public static function create($oventTypeID, $time, $eventID, $relationalID, $additionalFields = array(), $checked = 0, $data = array())
{
if (!is_array($data)) {
$data = array($data);
}
$oventID = self::insert($oventTypeID, $time, $eventID, $relationalID, $additionalFields, $checked, $data);
$oventObj = Ovent::getByOventID($oventID);
if (isset($additionalFields['userID']) && UserSettings::getSetting($additionalFields['userID'], 'hideOventType' . $oventTypeID)) {
$oventObj->getEditor()->check();
}
return $oventObj;
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:24,代码来源:OventEditor.class.php
示例6: GetLang4User
public function GetLang4User($userid)
{
if (!is_numeric($userid)) {
throw new Exception("User ID is not numeric");
}
$usersettings = UserSettings::getInstance();
$userlang = $usersettings->Get($userid, 'language');
$userlang = $userlang['language'];
if (!preg_match('/[a-z]{2}/i', $userlang)) {
$settings = Settings::getInstance();
$userlang = $settings->Get('system.lang.default');
}
return $userlang;
}
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:14,代码来源:class.Lang.php
示例7: convertDate
public function convertDate($model, $str)
{
echo $str;
if ($str != null) {
$settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
if ($settings != NULL) {
$str = date($settings->displaydate, strtotime($str));
echo $date1;
}
} else {
$str = '';
}
return $str;
}
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:14,代码来源:FinanceFeeCollections.php
示例8: saveFeed
public function saveFeed($initiator_id, $activity_type, $goal_id, $goal_name, $field_name, $initial_field_value, $new_field_value)
{
$model = new ActivityFeed();
$model->initiator_id = $initiator_id;
$model->activity_type = $activity_type;
$model->goal_id = $goal_id;
$model->goal_name = $goal_name;
$model->field_name = $field_name;
$model->initial_field_value = $initial_field_value;
$model->new_field_value = $new_field_value;
$settings = UserSettings::model()->findByAttributes(array('user_id' => 1));
if ($settings != NULL) {
$timezone = Timezone::model()->findByAttributes(array('id' => $settings->timezone));
date_default_timezone_set($timezone->timezone);
}
$model->activity_time = date('Y-m-d H:i:s');
$model->save();
}
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:18,代码来源:ActivityFeed.php
示例9: create
/**
* Creates a new game account.
*
* @param int user id
* @param string user name
* @param string email
*/
public static function create($userID, $username, $email)
{
$sql = "INSERT INTO ugml_users\n\t\t\t\t(id, username, email,\n\t\t\t\t email_2, register_time, lastLoginTime,\n\t\t\t\t dilizium, diliziumFeatures)\n\t\t\t\tVALUES\n\t\t\t\t(" . $userID . ", '" . escapeString($username) . "', '" . escapeString($email) . "',\n\t\t\t\t '" . $email . "', " . time() . ", " . time() . ",\n\t\t\t\t 500, 'a:0:{}')";
WCF::getDB()->sendQuery($sql);
$sql = "UPDATE ugml_config\n\t\t\t\tSET config_value = (SELECT COUNT(*)\n\t\t\t\t\t\t\t\t\tFROM ugml_users)\n\t\t\t\tWHERE config_name = 'users_amount'";
WCF::getDB()->sendQuery($sql);
$accountEditor = new AccountEditor($userID);
// TODO: event listener
require_once LW_DIR . 'lib/data/news/News.class.php';
require_once LW_DIR . 'lib/data/user/UserSettings.class.php';
WCF::getCache()->addResource('news-' . PACKAGE_ID, WCF_DIR . 'cache/cache.news-' . PACKAGE_ID . '.php', LW_DIR . 'lib/system/cache/CacheBuilderNews.class.php');
$news = WCF::getCache()->get('news-' . PACKAGE_ID);
foreach ($news as $key => $newsItem) {
if ($key != "hash") {
UserSettings::setSetting($userID, $newsItem->getIdentifier(), TIME_NOW);
}
}
return $accountEditor;
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:26,代码来源:AccountEditor.class.php
示例10: printInsert
function printInsert()
{
global $tpl, $us, $badgerDb;
$widgets = new WidgetEngine($tpl);
$widgets->addNavigationHead();
$insertTitle = getBadgerTranslation2('importExport', 'insertTitle');
$updateInfo = '';
echo $tpl->getHeader($insertTitle);
$goToStartPagePreLink = getBadgerTranslation2('importExport', 'goToStartPagePreLink');
$goToStartPageLinkText = getBadgerTranslation2('importExport', 'goToStartPageLinkText');
$goToStartPagePostLink = getBadgerTranslation2('importExport', 'goToStartPagePostLink');
if (!isset($_POST['confirmUpload']) || getGPC($_POST, 'confirmUpload') !== 'yes') {
$insertMsg = getBadgerTranslation2('importExport', 'insertNoInsert');
} else {
if (!isset($_FILES['sqlDump']) || !is_uploaded_file($_FILES['sqlDump']['tmp_name'])) {
$insertMsg = getBadgerTranslation2('importExport', 'insertNoFile');
} else {
$insertMsg = getBadgerTranslation2('importExport', 'insertSuccessful');
$newerVersionMsg = getBadgerTranslation2('importExport', 'newerVersion');
if (applySqlDump() === 'newerVersion') {
eval(' $updateInfo = "' . $tpl->getTemplate('importExport/newerVersion') . '";');
}
}
}
$us = new UserSettings($badgerDb);
$startPageURL = BADGER_ROOT . '/' . $us->getProperty('badgerStartPage');
eval('echo "' . $tpl->getTemplate('importExport/insert') . '";');
eval('echo "' . $tpl->getTemplate('badgerFooter') . '";');
}
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:29,代码来源:importExport.php
示例11: UserSettings
?>
</span>
</div>
</div>
<div class="contentfull">
<div class="messageshadow">
<div class="messages" style="font-size:1.8em;">Ofuz Getting started wizard</div>
</div>
<div align="center">
<p id="pYourFirstProject" style="font-size:1.4em;">Setup your Invoices</p>
<div class="spacerblock_20"></div>
<div id="setup_invoices">
<div>
<?php
$UserSettings = new UserSettings();
$UserSettings->sessionPersistent("InvLogo", "index.php", OFUZ_TTL);
//$UserSettings->sessionPersistent("InvCurrency", "index.php", OFUZ_TTL);
//$UserSettings->sessionPersistent("InvDateFormat", "index.php", OFUZ_TTL);
//$UserSettings->sessionPersistent("InvAuthNet", "index.php", OFUZ_TTL);
//$UserSettings->sessionPersistent("InvPaypal", "index.php", OFUZ_TTL);
// Invoice Logo section
$inv_logo = $UserSettings->getSettingValue("invoice_logo");
if ($inv_logo && is_array($inv_logo)) {
$_SESSION['InvLogo']->getId($inv_logo["iduser_settings"]);
$img = $_SESSION['InvLogo']->setting_value;
$e_inv_logo = new Event("InvLogo->eventValuesFromForm");
$e_inv_logo->addEventAction("InvLogo->update", 2000);
$e_inv_logo->addEventAction("InvLogo->eventCheckInvLogoExtension", 2);
echo '<table width="50%" height="100px"><tr><td width="40%">';
$e_inv_logo->setGotFile(true);
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:ww_s4.php
示例12: convertTime
public function convertTime($time)
{
$settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
if ($settings != NULL) {
$time1 = date($settings->timeformat, strtotime($time));
}
echo $time1;
}
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:8,代码来源:ClassTimingController.php
示例13: init_order_param
/**
* Initialize the order param
*/
function init_order_param()
{
global $UserSettings;
if (empty($UserSettings)) {
$UserSettings = new UserSettings();
}
// attribution of an order type
$this->order_param = 'results_' . $this->param_prefix . 'order';
$order_request = param($this->order_param, 'string', '', true);
// remove symbols '-' from the end
$order_request = rtrim($order_request, '-');
if ($this->force_order_by_count !== NULL && !empty($order_request)) {
// Check if we should force an order filed to default value
if ($this->get_total_rows() > $this->force_order_by_count) {
// This table has very much records we should force an order to default
$reverse_default_order = str_replace('D', 'A', $this->default_order);
$reverse_default_order = $reverse_default_order == $this->default_order ? str_replace('A', 'D', $this->default_order) : $reverse_default_order;
if ($order_request != $this->default_order && $order_request != $reverse_default_order) {
// If an order from request is not default then we must change it to default
$this->order = $this->default_order;
$order_request_title = $order_request;
if (isset($this->cols)) {
// Try to find a title of the ordered field to display it in warning message
$order_index = strpos($order_request, 'A');
$order_index = $order_index === FALSE ? strpos($order_request, 'D') : $order_index;
if (isset($this->cols[$order_index]) && isset($this->cols[$order_index]['th'])) {
$order_request_title = $this->cols[$order_index]['th'];
}
}
// Add a message to inform user about this order type is not allowed in this case
$this->add_message(sprintf(T_('In order to maintain good performance, you cannot sort by %s when there are more than %s results.'), $order_request_title, number_format($this->force_order_by_count, 0, '', ' ')));
}
}
}
if (empty($this->order)) {
// Set an order from GET request
$this->order = $order_request;
}
if (!empty($this->param_prefix) && !empty($this->order) && $this->order != $UserSettings->get($this->order_param)) {
// Change an order param in DB for current user and current list
if ($this->order == $this->default_order) {
// Delete an order param for current list if it is a default value
$UserSettings->delete($this->order_param);
} else {
// Set a new value of an order param for current list
$UserSettings->set($this->order_param, $this->order);
}
$UserSettings->dbupdate();
}
if (!empty($this->param_prefix) && empty($this->order)) {
// Set an order param from DB
if ($UserSettings->get($this->order_param) != '') {
// Set a value for current list if it was already defined
$this->order = $UserSettings->get($this->order_param);
}
}
if (empty($this->order)) {
// Set a default value
$this->order = $this->default_order;
}
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:64,代码来源:_results.class.php
示例14: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($sid)
{
$model = $this->loadModel($sid);
$old_model = $model->attributes;
// For activity feed
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
if ($settings != NULL) {
$model->start_time = date($settings->displaydate . ' ' . $settings->timeformat, strtotime($model->start_time));
$model->end_time = date($settings->displaydate . ' ' . $settings->timeformat, strtotime($model->end_time));
$old_start_time = date($settings->displaydate . ' ' . $settings->timeformat, strtotime($old_model['start_time']));
// For activity feed
$old_end_time = date($settings->displaydate . ' ' . $settings->timeformat, strtotime($old_model['end_time']));
// For activity feed
}
if (isset($_POST['Exams'])) {
$model->attributes = $_POST['Exams'];
$list = $_POST['Exams'];
if ($model->start_time) {
$date1 = date('Y-m-d H:i', strtotime($list['start_time'][0]));
$model->start_time = $date1;
$activity_start = date($settings->displaydate . ' ' . $settings->timeformat, strtotime($model->start_time));
// For activity feed
}
if ($model->end_time) {
$date2 = date('Y-m-d H:i', strtotime($list['end_time'][0]));
$model->end_time = $date2;
$activity_end = date($settings->displaydate . ' ' . $settings->timeformat, strtotime($model->end_time));
// For activity feed
}
if ($model->save()) {
// Saving to activity feed
$results = array_diff_assoc($model->attributes, $old_model);
// To get the fields that are modified.
foreach ($results as $key => $value) {
if ($key != 'updated_at') {
if ($key == 'start_time') {
$value = $activity_start;
$old_model[$key] = $old_start_time;
} elseif ($key == 'end_time') {
$value = $activity_end;
$old_model[$key] = $old_end_time;
}
$subject_name = Subjects::model()->findByAttributes(array('id' => $model->subject_id));
$examgroup = ExamGroups::model()->findByAttributes(array('id' => $model->exam_group_id));
$batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id));
$exam = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')';
//Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '18', $model->id, $exam, $model->getAttributeLabel($key), $old_model[$key], $value);
}
}
//END saving to activity feed
$this->redirect(array('exams/create', 'id' => $_REQUEST['id'], 'exam_group_id' => $_REQUEST['exam_group_id']));
}
}
$this->render('update', array('model' => $model));
}
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:63,代码来源:ExamsController.php
示例15: UserPersonalSettings
public static function UserPersonalSettings()
{
$xtpl = self::$xtpl;
$nm = NotificationModule::getInstance();
$lang = Lang::getInstance();
$setting = Settings::getInstance();
$usrstg = UserSettings::getInstance();
$curr = Currency::getInstance();
$xtpl->assign('SETCURR', 'current');
$xtpl->assign('SYSTEMCURRSETT', 'current');
$nms = $nm->GetButch();
$langs = $lang->GetButch();
$currs = $curr->GetButch();
if ($usersettings = $usrstg->Get(self::$userid)) {
$xtpl->assign('NOTIFYADDRESS', $usersettings['notifyaddress']);
if ($usersettings['usernewinvoice'] == "1") {
$xtpl->assign('NEWINVSEL', 'checked="checked"');
}
if ($usersettings['userneworder'] == "1") {
$xtpl->assign('NEWORDSEL', 'checked="checked"');
}
if ($usersettings['usernewticket'] == "1") {
$xtpl->assign('NEWTCSEL', 'checked="checked"');
}
if ($usersettings['usernewticketreply'] == "1") {
$xtpl->assign('NEWTRSEL', 'checked="checked"');
}
}
for ($i = 0; $i < count($nms); $i++) {
if ($nms[$i]['id'] == @$usersettings['notifymodule'] || $nms[$i]['id'] == $setting->Get('system.notifymodule.default')) {
$xtpl->assign('DEFAULT', 'selected="selected"');
} else {
$xtpl->assign('DEFAULT', '');
}
$xtpl->assign('NM', $nms[$i]);
$xtpl->parse('main.personalsettings.ntlist');
}
for ($i = 0; $i < count($langs); $i++) {
if ($langs[$i]['code'] == @$usersettings['language'] || $langs[$i]['code'] == $setting->Get('system.lang.default')) {
$xtpl->assign('DEFAULT', 'selected="selected"');
} else {
$xtpl->assign('DEFAULT', '');
}
//var_dump($langs[$i]);
$xtpl->assign('LNG', $langs[$i]);
$xtpl->parse('main.personalsettings.langlist');
}
for ($i = 0; $i < count($currs); $i++) {
if ($currs[$i]['name'] == @$usersettings['currency'] || $currs[$i]['name'] == $setting->Get('system.currency')) {
$xtpl->assign('DEFAULT', 'selected="selected"');
} else {
$xtpl->assign('DEFAULT', '');
}
$xtpl->assign('CURR', $currs[$i]);
$xtpl->parse('main.personalsettings.currlist');
}
$xtpl->parse('main.personalsettings');
$xtpl->parse('main');
$xtpl->out('main');
}
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:60,代码来源:class.Page.php
示例16: actionAjax_Update
public function actionAjax_Update()
{
if (isset($_POST['ExamGroups'])) {
$model = $this->loadModel($_POST['update_id']);
// For SMS
$prev_name = $model->name;
$prev_is_published = $model->is_published;
// Fetching previous is_published
$prev_result_published = $model->result_published;
// Fetching previous result_published
$prev_exam_date = $model->exam_date;
//Fetching previous exam date
// End For SMS
// For Activity Feed
$old_model = $model->attributes;
// For activity feed
$settings = UserSettings::model()->findByAttributes(array('user_id' => 1));
if ($settings != NULL) {
$old_exam_date = date($settings->displaydate, strtotime($old_model['exam_date']));
}
// End For Activity Feed
$model->attributes = $_POST['ExamGroups'];
$model->exam_date = date('Y-m-d', strtotime($model->exam_date));
if ($model->save(false)) {
// Saving to activity feed
$results = array_diff_assoc($model->attributes, $old_model);
// To get the fields that are modified.
foreach ($results as $key => $value) {
if ($key == 'name') {
$value = ucfirst($value);
} elseif ($key == 'is_published') {
if ($value == 1) {
$value = 'Published';
} else {
$value = 'Not Published';
}
if ($old_model[$key] == 1) {
$old_model[$key] = 'Published';
} else {
$old_model[$key] = 'Not Published';
}
} elseif ($key == 'result_published') {
if ($value == 1) {
$value = 'Result Published';
} else {
$value = 'Result Not Published';
}
if ($old_model[$key] == 1) {
$old_model[$key] = 'Result Published';
} else {
$old_model[$key] = 'Result Not Published';
}
} elseif ($key == 'exam_date') {
$value = $_POST['ExamGroups']['exam_date'];
$old_model[$key] = $old_exam_date;
}
//Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '12', $model->id, ucfirst($model->name), $model->getAttributeLabel($key), $old_model[$key], $value);
}
//END saving to activity feed
// Send SMS if saved
$sms_settings = SmsSettings::model()->findAll();
$to = '';
$message = '';
// Send Schedule SMS only if, SMS is enabled and schedule is published
if ($sms_settings[0]->is_enabled == '1' and $sms_settings[5]->is_enabled == '1') {
$students = Students::model()->findAll("batch_id=:x", array(':x' => $model->batch_id));
//Selecting students of the batch
foreach ($students as $student) {
if ($student->phone1) {
// Checking if phone number is provided
$to = $student->phone1;
} elseif ($student->phone2) {
$to = $student->phone2;
}
if ($to != '') {
// Sending SMS to each student
$college = Configurations::model()->findByPk(1);
$from = $college->config_value;
if ($prev_is_published == '0' and $model->is_published == '1' and $prev_result_published == '0' and $model->result_published == '0') {
// If exam schedule made published and result is not published
$message = $model->name . ' is scheduled';
} elseif ($prev_is_published == '1' and $model->is_published == '1' and $prev_result_published == '0' and $model->result_published == '0') {
// If exam schedule already published and result is not published
if (strcasecmp($prev_name, $model->name) == 0) {
// Checking if exam name is changed and if not changed.
if (strcasecmp($prev_exam_date, $model->exam_date) != 0) {
$message = $model->name . ' schedule is modified';
}
} else {
// If exam name is changed.
$message = 'Notice: Exam name "' . $prev_name . '" changed to "' . $model->name . '"';
if (strcasecmp($prev_exam_date, $model->exam_date) != 0) {
// if exam name is changed and date is also changed.
$message .= ' Also, the schedule is modified';
}
}
}
if ($message != '') {
// Send SMS if there is some message.
//.........这里部分代码省略.........
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:101,代码来源:Backup+1+of+ExamController.php
示例17: convertTime
public function convertTime($date)
{
$settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
if ($settings != NULL) {
$date1 = date($settings->displaydate, strtotime($date));
echo $date1 . '<br>' . date($settings->timeformat, strtotime($date));
}
}
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:8,代码来源:ExamsController.php
示例18: RemoveNotification
public static function RemoveNotification($userId)
{
return UserSettings::model()->deleteAll('user_id=:userId', array(':userId' => $userId));
}
开发者ID:romeo14,项目名称:wallfeet,代码行数:4,代码来源:NotificationLabelApi.php
示例19: foreach
</td>
<td align="center"><?php
echo Yii::t('Courses', 'Start Date');
?>
</td>
<td align="center"><?php
echo Yii::t('Courses', 'End Date');
?>
</td>
</tr>
<?php
foreach ($batch as $batch_1) {
echo '<tr id="batchrow' . $batch_1->id . '">';
echo '<td style="text-align:left; padding-left:10px; font-weight:bold;">' . CHtml::link($batch_1->name, array('/teachersportal/default/studentattendance', 'id' => $batch_1->id)) . '</td>';
$settings = UserSettings::model()->findByAttributes(array('id' => 1));
if ($settings != NULL) {
$date1 = date($settings->displaydate, strtotime($batch_1->start_date));
$date2 = date($settings->displaydate, strtotime($batch_1->end_date));
}
$teacher = Employees::model()->findByAttributes(array('id' => $batch_1->employee_id));
echo '<td align="center">';
if ($teacher) {
echo $teacher->first_name . ' ' . $teacher->last_name;
} else {
echo '-';
}
echo '</td>';
echo '<td align="center">' . $date1 . '</td>';
echo '<td align="center">' . $date2 . '</td>';
echo '</tr>';
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:31,代码来源:studattendance.php
示例20: checkAll
/**
* Sets the 'checked'-flag for the messages of a given user.
*
* @param int userID
* @param int checked
* @param array folderIDs
*/
public function checkAll($userID, $checked = 1, $folderIDs = null)
{
$sql = "UPDATE ugml_message\n\t\t\t\tSET checked = " . $checked . "\n\t\t\t\tWHERE recipentID = " . $userID;
if ($folderIDs !== null && count($folderIDs)) {
$sql .= " AND folderID IN (" . implode(',', $folderIDs) . ")";
}
WCF::getDB()->sendQuery($sql);
$sql = "SELECT COUNT(*) AS count\n\t\t\t\tFROM ugml_message\n\t\t\t\tWHERE checked = 1\n\t\t\t\t\tAND recipentID = " . $userID;
$row = WCF::getDB()->getFirstRow($sql);
UserSettings::setSetting($userID, 'checkedMessages', intval($row['count']));
}
开发者ID:Biggerskimo,项目名称:WOT-Game,代码行数:18,代码来源:NMessageEditor.class.php
注:本文中的UserSettings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论