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]; }
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'); }
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; }
/** * 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; }
/** * 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; }
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; }
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; }
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(); }
/** * 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; }
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') . '";'); }
?> </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);
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; }
/** * 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; } }
/** * 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)); }
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'); }
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. SmsSettings::model()->sendSms($to, $from, $message); } } // End send SMS to each student } } // Send Result SMS only if, SMS is enabled and result is published if ($sms_settings[0]->is_enabled == '1' and $sms_settings[6]->is_enabled == '1') { // Exam Result SMS if ($model->is_published == '1' and $prev_result_published == '0' and $model->result_published == '1') { //If result is published $college = Configurations::model()->findByPk(1); $from = $college->config_value; $message = $model->name . ' result published'; SmsSettings::model()->sendSms($to, $from, $message); } } // END sending SMS echo json_encode(array('success' => true)); } else { echo json_encode(array('success' => false)); } } }
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)); } }
public static function RemoveNotification($userId) { return UserSettings::model()->deleteAll('user_id=:userId', array(':userId' => $userId)); }
</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>';
/** * 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'])); }
* This file implements the comments moderation reminder cron job * * @author attila: Attila Simo * * @version $Id: $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $DB, $Settings, $UserSettings; global $servertimenow, $comment_moderation_reminder_threshold; // Check if UserSettings exists because it must be initialized before email sending if (empty($UserSettings)) { // initialize UserSettings, because in CLI mode is not initialized yet load_class('users/model/_usersettings.class.php', 'UserSettings'); $UserSettings = new UserSettings(); } // Only those blogs are selected for moderation where we can find at least one comment awaiting moderation which is older then the threshold date defined below $threshold_date = date2mysql($servertimenow - $comment_moderation_reminder_threshold); // Statuses defined in this array should be notified. This should be configurable, but this is the default value. $notify_statuses = get_visibility_statuses('moderation'); // Select blogs where are comments awaiting moderation more then x ( = configured threshold ) hours $SQL = new SQL(); $SQL->SELECT('DISTINCT cat_blog_ID'); $SQL->FROM('T_categories'); $SQL->FROM_add('INNER JOIN T_items__item ON post_main_cat_ID = cat_ID AND post_status IN (' . $DB->quote(array('published', 'community', 'protected')) . ')'); $SQL->FROM_add('INNER JOIN T_comments ON comment_post_ID = post_ID AND comment_status IN (' . $DB->quote($notify_statuses) . ') AND comment_date < ' . $DB->quote($threshold_date)); $moderation_blogs = $DB->get_col($SQL->get()); if (empty($moderation_blogs)) { // There are no blogs where exists draft comments older then the threshold ( 24 hours by default ) $result_message = sprintf(T_('No comments have been awaiting moderation for more than %s.'), seconds_to_period($comment_moderation_reminder_threshold));
/** * Returns all fields in an array. * * The result has the following form: * array ( * array ( * 'field name 0' => 'value of field 0', * 'field name 1' => 'value of field 1' * ) * ); * * The inner array is repeated for each row. * The fields need to be in the order returned by @link getFieldNames(). * * @return array A list of all fields. */ public function getAll() { global $badgerDb; $us = new UserSettings($badgerDb); $tpl = new TemplateEngine($us, BADGER_ROOT); $widgets = new WidgetEngine($tpl); $currentLanguage = $us->getProperty('badgerLanguage'); $result = array(); switch ($this->type) { case 'transaction': $this->fetchTransactions(); $sum = new Amount(); foreach ($this->finishedTransactions as $currentTransaction) { $sum->add($currentTransaction->getAmount()); $result[] = array('transactionId' => $currentTransaction->getId(), 'type' => $widgets->addImage($currentTransaction->getType() == 'FinishedTransaction' ? 'Account/finished_transaction.png' : 'Account/planned_transaction.png', 'title="' . getBadgerTranslation2('Account', $currentTransaction->getType()) . '"'), 'title' => $currentTransaction->getTitle(), 'description' => $currentTransaction->getDescription(), 'valutaDate' => ($tmp = $currentTransaction->getValutaDate()) ? $tmp->getFormatted() : '', 'amount' => $currentTransaction->getAmount()->getFormatted(), 'outsideCapital' => is_null($tmp = $currentTransaction->getOutsideCapital()) ? '' : $tmp, 'transactionPartner' => $currentTransaction->getTransactionPartner(), 'categoryId' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getId() : '', 'categoryTitle' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getTitle() : '', 'sum' => $sum->getFormatted()); } break; case 'finished': while ($this->fetchNextFinishedTransaction()) { } foreach ($this->finishedTransactions as $currentTransaction) { $result[] = array('finishedTransactionId' => $currentTransaction->getId(), 'title' => $currentTransaction->getTitle(), 'description' => $currentTransaction->getDescription(), 'valutaDate' => ($tmp = $currentTransaction->getValutaDate()) ? $tmp->getFormatted() : '', 'amount' => $currentTransaction->getAmount()->getFormatted(), 'outsideCapital' => is_null($tmp = $currentTransaction->getOutsideCapital()) ? '' : $tmp, 'transactionPartner' => $currentTransaction->getTransactionPartner(), 'categoryId' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getId() : '', 'categoryTitle' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getTitle() : '', 'exceptional' => is_null($tmp = $currentTransaction->getExceptional()) ? '' : $tmp, 'periodical' => is_null($tmp = $currentTransaction->getPeriodical()) ? '' : $tmp); } break; case 'planned': while ($this->fetchNextPlannedTransaction()) { } foreach ($this->plannedTransactions as $currentTransaction) { $result[] = array('plannedTransactionId' => 'p' . $currentTransaction->getId() . '_X', 'title' => $currentTransaction->getTitle(), 'description' => $currentTransaction->getDescription(), 'amount' => $currentTransaction->getAmount()->getFormatted(), 'outsideCapital' => is_null($tmp = $currentTransaction->getOutsideCapital()) ? '' : $tmp, 'transactionPartner' => $currentTransaction->getTransactionPartner(), 'beginDate' => $currentTransaction->getBeginDate()->getFormatted(), 'endDate' => ($tmp = $currentTransaction->getEndDate()) ? $tmp->getFormatted() : '', 'repeatUnit' => getBadgerTranslation2('Account', $currentTransaction->getRepeatUnit()), 'repeatFrequency' => $currentTransaction->getRepeatFrequency(), 'categoryId' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getId() : '', 'categoryTitle' => ($tmp = $currentTransaction->getCategory()) ? $tmp->getTitle() : ''); } break; } return $result; }
public function actionDeleteLeave() { $flag = true; $model = StudentAttentance::model()->findByAttributes(array('id' => $_REQUEST['id'])); $attendance = StudentAttentance::model()->DeleteAllByAttributes(array('id' => $_REQUEST['id'])); $student = Students::model()->findByAttributes(array('id' => $model->student_id)); $settings = UserSettings::model()->findByAttributes(array('user_id' => 1)); if ($settings != NULL) { $date = date($settings->displaydate, strtotime($model->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, '10', $model->student_id, ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name), $date, NULL, NULL); if ($flag) { Yii::app()->clientScript->scriptMap['jquery.js'] = false; $this->renderPartial('update', array('model' => $model, 'day' => $_GET['day'], 'month' => $_GET['month'], 'year' => $_GET['year'], 'emp_id' => $_GET['emp_id']), false, true); } }
/** * @brief Sharing a file or folder via link/public * @param array $params The hook params */ public static function shareFileOrFolder($params) { if (UserSettings::getUserSetting(\OCP\User::getUser(), 'setting', 'self') && UserSettings::getUserSetting(\OCP\User::getUser(), 'stream', Data::TYPE_SHARED)) { $path = \OC\Files\Filesystem::getPath($params['fileSource']); $link = \OCP\Util::linkToAbsolute('files', 'index.php', array('dir' => $params['itemType'] === 'file' ? dirname($path) : $path)); Data::send('files', 'shared_link_self', array($path), '', array(), $path, $link, \OCP\User::getUser(), Data::TYPE_SHARED, Data::PRIORITY_MEDIUM); } }
?> <?php echo CHtml::link(Yii::t('weekdays', 'Generate PDF'), array('Weekdays/pdf', 'id' => $_REQUEST['id']), array('class' => 'cbut', 'target' => '_blank')); ?> </div> <div class="timetable" style="margin-top:10px;"> <table border="0" align="center" width="100%" id="table" cellspacing="0"> <tbody> <tr> <td class="loader"> </td><!--timetable_td_tl --> <td class="td-blank"></td> <?php foreach ($timing as $timing_1) { $settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id)); if ($settings != NULL) { $time1 = date($settings->timeformat, strtotime($timing_1->start_time)); $time2 = date($settings->timeformat, strtotime($timing_1->end_time)); } echo '<td class="td"><div class="top">' . $time1 . ' - ' . $time2 . '</div></td>'; //echo '<td class="td"><div class="top">'.$timing_1->start_time.' - '.$timing_1->end_time.'</div></td>'; } ?> </tr> <!-- timetable_tr --> <tr class="blank"> <td></td> <td></td> <?php for ($i = 0; $i < $count_timing; $i++) { echo '<td></td>';
<?php include_once "config.php"; $setting = new UserSettings(); $setting->setSetting("philinfo2", "value2"); ?>
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Configurations(); $logo = new Logo(); $err_flag = 0; // Uncomment the following line if AJAX validation is needed //$this->performAjaxValidation($model); //exit; if (isset($_POST['submit'])) { $posts_1 = Configurations::model()->findByAttributes(array('id' => 1)); $posts_1->config_value = $_POST['collegename']; $posts_1->save(); $posts_2 = Configurations::model()->findByAttributes(array('id' => 2)); $posts_2->config_value = $_POST['address']; $posts_2->save(); $posts_3 = Configurations::model()->findByAttributes(array('id' => 3)); $posts_3->config_value = $_POST['phone']; $posts_3->save(); $posts_4 = Configurations::model()->findByAttributes(array('id' => 4)); $posts_4->config_value = $_POST['attentance']; $posts_4->save(); $posts_5 = Configurations::model()->findByAttributes(array('id' => 13)); $posts_5->config_value = $_POST['startyear']; $posts_5->save(); $posts_6 = Configurations::model()->findByAttributes(array('id' => 14)); $posts_6->config_value = $_POST['endyear']; $posts_6->save(); /*$posts_7=Configurations::model()->findByAttributes(array('id'=>14)); $posts_7->config_value = $_POST['currency']; $posts_7->save();*/ $posts_8 = Configurations::model()->findByAttributes(array('id' => 5)); $posts_8->config_value = $_POST['currency']; $posts_8->save(); $posts_9 = Configurations::model()->findByAttributes(array('id' => 6)); $posts_9->config_value = $_POST['language']; $posts_9->save(); /*$posts_10=Configurations::model()->findByAttributes(array('id'=>6)); $posts_10->config_value = $_POST['logo']; $posts_10->save();*/ if ($file = CUploadedFile::getInstance($logo, 'uploadedFile')) { $logo = new Logo(); $logo->photo_file_name = $file->name; $logo->photo_content_type = $file->type; $logo->photo_file_size = $file->size; $logo->photo_data = file_get_contents($file->tempName); if (!is_dir('uploadedfiles/')) { mkdir('uploadedfiles/'); } if (!is_dir('uploadedfiles/school_logo/')) { mkdir('uploadedfiles/school_logo/'); } move_uploaded_file($file->tempName, 'uploadedfiles/school_logo/' . $file->name); $file->saveAs($_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . 'uploadedfiles/school_logo/' . $file->name); // image //$logo->save(); if ($logo->save()) { } else { $err_flag = 1; } $posts_10 = Configurations::model()->findByAttributes(array('id' => 18)); $posts_10->config_value = Yii::app()->db->getLastInsertId(); $posts_10->save(); } if (isset($_POST['dateformat']) && isset($_POST['timeformat']) && isset($_POST['timezone']) && isset($_POST['language'])) { $settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id)); $date = ''; if ($settings != NULL) { $settings->user_id = Yii::app()->user->id; $settings->dateformat = $_POST['dateformat']; if ($_POST['dateformat'] == 'm/d/yy') { $settings->displaydate = 'm/d/Y'; } else { if ($_POST['dateformat'] == 'M d.yy') { $settings->displaydate = 'M d.Y'; } else { if ($_POST['dateformat'] == 'D, M d.yy') { $settings->displaydate = 'D, M d.Y'; } else { if ($_POST['dateformat'] == 'd M yy') { $settings->displaydate = 'd M Y'; } else { if ($_POST['dateformat'] == 'yy/m/d') { $settings->displaydate = 'Y/m/d'; } } } } } $settings->timeformat = $_POST['timeformat']; $settings->timezone = $_POST['timezone']; $settings->language = $_POST['language']; } else { $settings = new UserSettings(); $settings->user_id = Yii::app()->user->id; $settings->dateformat = $_POST['dateformat']; if ($_POST['dateformat'] == 'm/d/yy') { $settings->displaydate = 'm/d/Y'; } else { if ($_POST['dateformat'] == 'M d.yy') { $settings->displaydate = 'M d.Y'; } else { if ($_POST['dateformat'] == 'D, M d.yy') { $settings->displaydate = 'D, M d.Y'; } else { if ($_POST['dateformat'] == 'd M yy') { $settings->displaydate = 'd M Y'; } else { if ($_POST['dateformat'] == 'yy/m/d') { $settings->displaydate = 'Y/m/d'; } } } } } $settings->timeformat = $_POST['timeformat']; $settings->timezone = $_POST['timezone']; $settings->language = $_POST['language']; } $settings->save(); } $posts_11 = Configurations::model()->findByAttributes(array('id' => 12)); $posts_11->config_value = $_POST['network']; $posts_11->save(); $posts_12 = Configurations::model()->findByAttributes(array('id' => 7)); $posts_12->config_value = $_POST['admission_number']; $posts_12->save(); $posts_13 = Configurations::model()->findByAttributes(array('id' => 8)); $posts_13->config_value = $_POST['employee_number']; $posts_13->save(); //$model->attributes=$_POST['Configurations']; //if($model->save()) if ($err_flag == 0) { Yii::app()->user->setFlash('errorMessage', UserModule::t("Configurations saved successfully!")); $this->redirect(array('create')); } } $this->render('create', array('model' => $model, 'logo' => $logo)); }
public static function GetSettings() { $userSettings = new UserSettings(); $settingsFilePath = Paths::getWDMConfigPath(); if (file_exists($settingsFilePath)) { $userSettings->Load($settingsFilePath); } return $userSettings; }
// Copyright 2008-2011 SQLFusion LLC info@sqlfusion.com /**COPYRIGHTS**/ /** * OfflineContacts post configuration * Here we update the Tabs * If google gear is turn on we link the Contacts tab * to the ggears_contacts. * * @package OfflineContacts * @author Philippe Lewicki <*****@*****.**> * @license ##License## * @version 0.1 * @date 2010-09-04 */ if (isset($_SESSION['do_User'])) { $user_settings = new UserSettings(); if ($user_settings->getSetting("google_gears") == "Yes") { if ($GLOBALS['cfg_tab_placement']->count() > 0) { $new_tabs = new ArrayIterator(); $GLOBALS['cfg_tab_placement']->rewind(); while ($GLOBALS['cfg_tab_placement']->valid()) { $tab = $GLOBALS['cfg_tab_placement']->current(); if ($tab->getTabName() == _('Contacts')) { // uncomment the setPlugInName to link to the plugIn Folder. $tab->setPlugInName("OfflineContacts"); $tab->setTabName("Contacts Offline")->setPages(array("ggears_contacts"))->setDefaultPage("ggears_contacts"); } $GLOBALS['cfg_tab_placement']->next(); } } }
$GLOBALS['thistabsetting'] = 'Google Gears'; include_once 'includes/setting_tabs.php'; ?> <div class="settingsbottom"></div></div> </td><td class="layout_rcolumn"> <div class="banner60 pad020 text32"><?php echo _('Settings'); ?> </div> <div class="banner50 pad020 text16 fuscia_text"><?php echo _('Google Gears Setup'); ?> </div> <div class="contentfull"> <?php $UserSettings = new UserSettings(); $e_set_ggear = new Event("UserSettings->eventSetSetting"); $e_set_ggear->addParam("goto", $_SERVER['PHP_SELF']); $e_set_ggear->addParam("setting_name", "google_gears"); echo '<div class="messageshadow">'; echo '<div class="messages">'; $msg = new Message(); if ($UserSettings->getSetting("google_gears") == 'Yes') { echo $msg->getMessage('google_gears'); echo '<br />'; $e_set_ggear->addParam("setting_value", "No"); echo $e_set_ggear->getLink(_('Turn Off')); } else { echo $msg->getMessage('google_gears'); echo '<br />'; $e_set_ggear->addParam("setting_value", "Yes");