當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserSettings::save方法代碼示例

本文整理匯總了PHP中UserSettings::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserSettings::save方法的具體用法?PHP UserSettings::save怎麽用?PHP UserSettings::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserSettings的用法示例。


在下文中一共展示了UserSettings::save方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createSetting

 /**
  * This method accepts an array of data and creates the model.
  * Returns true if successfully created.
  * Returns the error validated model if validation fails.
  *
  * data array should have the following hash keys -
  * 1. id (optional)
  * 2. label
  * 3. value
  *
  * @param string $userId
  * @param array $data
  * @return string|model
  */
 public static function createSetting($userId, $data)
 {
     $model = new UserSettings();
     $model->user_id = $userId;
     $model->attributes = $data;
     if ($model->save()) {
         return true;
     } else {
         return $model;
     }
 }
開發者ID:romeo14,項目名稱:wallfeet,代碼行數:25,代碼來源:UserSettingApi.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new UserSettings();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['UserSettings'])) {
         $model->attributes = $_POST['UserSettings'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:SoftScape,項目名稱:open-school-CE,代碼行數:17,代碼來源:UserSettingsController.php

示例3: addNotification

 public static function addNotification($ids, $userId)
 {
     $count = 0;
     $remove = self::RemoveNotification($userId);
     $notificationLabel = NotificationLabel::model()->findAll();
     $count = count($notificationLabel);
     foreach ($notificationLabel as $notification) {
         $userSetting = new UserSettings();
         $userSetting->user_id = $userId;
         $userSetting->notification_label_id = $notification->id;
         if (in_array($notification->id, $ids, true)) {
             $userSetting->value = 1;
         } else {
             $userSetting->value = 0;
         }
         $userSetting->save();
     }
     return true;
 }
開發者ID:romeo14,項目名稱:wallfeet,代碼行數:19,代碼來源:NotificationLabelApi.php

示例4: actionCreate

 /**
  * 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') {
//.........這裏部分代碼省略.........
開發者ID:akilraj1255,項目名稱:rajeshwari,代碼行數:101,代碼來源:ConfigurationsController.php


注:本文中的UserSettings::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。