本文整理汇总了PHP中UserSettings类的典型用法代码示例。如果您正苦于以下问题:PHP UserSettings类的具体用法?PHP UserSettings怎么用?PHP UserSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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];
}
示例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');
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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') . '";');
}
示例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);
示例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;
}
示例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;
}
}
示例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));
}
示例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');
}