Example #1
0
function show_setting_form()
{
    $initialMoney = CSettingManager::GetSetting(CSettingManager::INITIAL_MONEY);
    $lastCheckTime = CSettingManager::GetSetting(CSettingManager::LAST_CHECK_TIME);
    $settingForm = new SettingForm($initialMoney, $lastCheckTime);
    $settingForm->Show();
}
 public function fetchData()
 {
     $this->activeRecord = null;
     $resultRaw = parent::fetchData();
     foreach ($resultRaw as $key => $value) {
         if (substr($key, 0, 1) == '_') {
             $key = substr($key, 1);
         }
         $result[$key] = $value;
     }
     $lang = Openbiz::$app->getClientProxy()->getFormInputs("fld_lang");
     $lang ? $lang : ($lang = I18n::getCurrentLangCode());
     $record_id = $result["Id"];
     $transDO = Openbiz::getObject($this->translateDO, 1);
     $currentRecord = $transDO->fetchOne("[lang]='{$lang}'");
     if ($currentRecord) {
         $currentRecord = $currentRecord->toArray();
         foreach ($currentRecord as $field => $value) {
             $result['_' . $field] = $value;
         }
     } else {
         $result['_repo_name'] = "";
         $result['_repo_desc'] = "";
     }
     return $result;
 }
Example #3
0
 /**
  * Override configurations.
  */
 public static function applySettings()
 {
     //apply setting for paypal
     if (Yii::app()->setting->getItem('transportType')) {
         Yii::app()->mail->transportType = Yii::app()->setting->getItem('transportType');
     }
     if (Yii::app()->mail->transportType == 'smtp') {
         foreach (self::$arrSmtp as $key => $value) {
             if (Yii::app()->setting->getItem($value)) {
                 Yii::app()->mail->transportOptions[$key] = Yii::app()->setting->getItem($value);
             }
         }
     } else {
         Yii::app()->mail->transportOptions = '';
     }
     //apply setting for general
     foreach (self::$arrGeneral as $key => $value) {
         if (Yii::app()->setting->getItem($value)) {
             Yii::app()->params[$key] = Yii::app()->setting->getItem($value);
         }
     }
     //apply setting for general
     self::$_paypalURL = Yii::app()->params['paypalURL'];
     //apply setting for paypal
     if (Yii::app()->setting->getItem('title')) {
         Yii::app()->name = Yii::app()->setting->getItem('title');
     }
 }
Example #4
0
 public function actionMailchimp()
 {
     $this->layout = 'column1';
     $model = new SettingForm();
     $model->scenario = "updateMailchimpSetting";
     $setting = Yii::app()->setting;
     if (isset($_POST['SettingForm'])) {
         $model->attributes = $_POST['SettingForm'];
         if ($model->validate()) {
             $setting->setDbItem('mailchimp_title_groups', $model->mailchimp_title_groups);
             $setting->setDbItem('mailchimp_api_key', $model->mailchimp_api_key);
             $setting->setDbItem('mailchimp_list_id', $model->mailchimp_list_id);
             Yii::app()->user->setFlash('setting', 'Setting has been updated.');
         }
     } else {
         $model->mailchimp_title_groups = $setting->getItem('mailchimp_title_groups');
         $model->mailchimp_api_key = $setting->getItem('mailchimp_api_key');
         $model->mailchimp_list_id = $setting->getItem('mailchimp_list_id');
     }
     $this->render('mailchimp', array('model' => $model));
 }
Example #5
0
<?php

defined('YII_DEBUG') or define('YII_DEBUG', true);
// including Yii
define('ROOT', dirname(__FILE__));
//$yii='yii-framework-1.1.15/yii.php'; // live
$yii = '../yii-1.1.15/yii.php';
// local
require_once $yii;
require __DIR__ . '/vendor/autoload.php';
// we'll use a separate config file
$config = dirname(__FILE__) . '/protected/config/cron.php';
// creating and running console application
Yii::createConsoleApplication($config);
SettingForm::applySettings();
//override settings by values from database
Yii::app()->run();