コード例 #1
0
ファイル: functions.php プロジェクト: Jtgadbois/Pedadida
/**
 * Set value of specific configuration option
 *
 * @param string $option_name
 * @param mixed $value
 * @return boolean
 */
function set_config_option($option_name, $value) {
	$config_option = ConfigOptions::getByName($option_name);
	if(!($config_option instanceof ConfigOption)) {
		return false;
	}

	$config_option->setValue($value);
	
	// update cache if available
	if (GlobalCache::isAvailable()) {
		GlobalCache::update('config_option_'.$option_name, $value);
	}
	
	return $config_option->save();
} // set_config_option
コード例 #2
0
ファイル: functions.php プロジェクト: rjv/Project-Pier
 /**
 * Set value of specific configuration option
 *
 * @param string $option_name
 * @param mixed $value
 * @return boolean
 */
 function set_config_option($option_name, $value) {
   $config_option = ConfigOptions::getByName($option_name);
   if (!($config_option instanceof ConfigOption)) {
     return false;
   } // if
   
   $config_option->setValue($value);
   return $config_option->save();
 } // set_config_option
コード例 #3
0
 function update_prefs()
 {
     prepare_company_website_controller($this, 'account');
     $user = logged_user();
     if (!$user instanceof User) {
         flash_error(lang('user dnx'));
         $this->redirectTo('dashboard');
     }
     // if
     $company = $user->getCompany();
     if (!$company instanceof Company) {
         flash_error(lang('company dnx'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     if (!$user->canUpdateProfile(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('dashboard');
     }
     // if
     $redirect_to = array_var($_GET, 'redirect_to');
     if (trim($redirect_to) == '' || !is_valid_url($redirect_to)) {
         $redirect_to = $user->getCardUrl();
     }
     // if
     $this->setTemplate('edit_preferences');
     $reminder_prefs = Reminders::findById(logged_user()->getId());
     if (!$reminder_prefs instanceof Reminder) {
         $reminder_prefs = new Reminder();
     }
     $prefs_form = array_var($_POST, 'prefs_form');
     $reminder_prefs->setUserId(logged_user()->getId());
     $reminder_prefs->setRemindersEnabled($prefs_form['reminders_enabled']);
     $reminder_prefs->setSummarizedBy($prefs_form['summarized_by']);
     $reminder_prefs->setRemindersFuture($prefs_form['future']);
     $reminder_prefs->setIncludeEveryone($prefs_form['ivsteam']);
     $weekArray = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     $days = '';
     for ($i = 0; $i < 7; $i++) {
         if (isset($prefs_form[$weekArray[$i]])) {
             $days .= "" . $weekArray[$i] . ",";
         }
     }
     $reminder_prefs->setReminderDaysToSend($days);
     $reminder_prefs->setReportsEnabled($prefs_form['reports_enabled']);
     $reminder_prefs->setReportsSummarizedBy($prefs_form['reports_summarized']);
     $reminder_prefs->setReportsIncludeEveryone($prefs_form['ivsteam2']);
     $reminder_prefs->setReportDay($prefs_form['reportDay']);
     $reminder_prefs->setReportsIncludeActivity($prefs_form['report_activity']);
     try {
         DB::beginWork();
         $reminder_prefs->save();
         DB::commit();
         flash_success(lang('prefs updated'));
     } catch (Exception $e) {
         DB::rollback();
         flash_error('Error: ' . $e);
     }
     $dayOfWeek = ConfigOptions::getByName('calendar_first_day_of_week');
     tpl_assign('dayOfWeek', $dayOfWeek->getValue());
     tpl_assign('redirect_to', $redirect_to);
     tpl_assign('user', $user);
     tpl_assign('company', $company);
     tpl_assign('reminder_prefs', $reminder_prefs);
 }