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


PHP Storage::model方法代碼示例

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


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

示例1: getPictureInfo

 /**
  * Gets the profile picture for a specifc user.
  * @param string $userId The Id of the user to get profile picture. If this is empty, the current user's avatar will be returned.
  * @param string $type The type of picture to return (original, thumb.profile, thumb.feed, thumb.icon)
  * @return array The picture info (path, alt, title, width, height)
  */
 public static function getPictureInfo($userId = '', $type = 'orginal')
 {
     if (empty($userId)) {
         $userId = Yii::app()->user->getId();
         if (empty($userId)) {
             return null;
         }
     }
     $pictureId = Profile::model()->getFieldInfo($userId, User::PREFIX, 'picture');
     if ($pictureId === null) {
         return self::getDefaultPicture($userId, $type);
     }
     $pictureInfo = Storage::model()->get($pictureId);
     // Alt and title
     $info = array('alt' => $pictureInfo['title'] . ' - ' . $pictureInfo['description'], 'title' => $pictureInfo['title']);
     // Path
     if ($type === 'original') {
         $info['path'] = $pictureInfo['storage_path'];
     } else {
         if (isset($pictureInfo[$type])) {
             $info['path'] = $pictureInfo[$type];
         } else {
             $info['path'] = Yii::app()->getBaseUrl(true) . '/files/images/error.jpg';
             $info['width'] = $info['height'] = 160;
         }
     }
     // Size
     if (!isset($info['width'])) {
         $imageInfo = getimagesize($info['path']);
         $info['width'] = $imageInfo[0];
         $info['height'] = $imageInfo[1];
     }
     return $info;
 }
開發者ID:redlaw,項目名稱:lintinzone,代碼行數:40,代碼來源:ProfilePicture.php

示例2: actionTodayStorage

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionTodayStorage()
 {
     $dates = date('Y:m:d');
     $depId = $_POST['depId'];
     $Products = array();
     /*$model = DepBalance::model()->with('products')->findAll('t.department_id = :depId AND t.type = :type',array(':depId'=>$depId,'type'=>1));
       foreach ($model as $val) {
           $products[$val->prod_id] = $val->getRelated('products')->name;
       }*/
     //$model = new Products();
     //$products = $model->getProdName($depId);
     $storageModel = Storage::model()->findAll();
     $balanceModel = Balance::model()->with('products')->findAll('b_date = :b_date', array(':b_date' => $dates));
     if (!empty($balanceModel)) {
         foreach ($balanceModel as $val) {
             $products[$val->prod_id] = $val->getRelated('products')->name;
             $Products[$val->prod_id] = $Products[$val->prod_id] + $val->startCount;
         }
     } else {
         foreach ($storageModel as $val) {
             $Products[$val->prod_id] = $Products[$val->prod_id] + $val->curCount;
         }
     }
     $realizedProd = Faktura::model()->with('realize.products')->findAll('date(realize_date) = :realize_date', array('realize_date' => $dates));
     foreach ($realizedProd as $value) {
         foreach ($value->getRelated('realize') as $val) {
             $Products[$val->prod_id] = $Products[$val->prod_id] + $val->count;
         }
     }
     $realizeStorageProd = DepFaktura::model()->with('realizedProd')->findAll('date(real_date) = :real_date AND fromDepId = :fromDepId', array(':real_date' => $dates, ':fromDepId' => 0));
     foreach ($realizeStorageProd as $value) {
         foreach ($value->getRelated('realizedProd') as $val) {
             $Products[$val->prod_id] = $Products[$val->prod_id] - $val->count;
         }
     }
     $expBalance = Yii::app()->db->createCommand()->select('ord.just_id,ord.count')->from('expense ex')->join('orders ord', 'ord.expense_id = ex.expense_id')->where('date(ex.order_date) = :dates AND ex.kind = :kind ', array(':dates' => $dates, ':kind' => 1))->queryAll();
     foreach ($expBalance as $val) {
         $Products[$val['just_id']] = $Products[$val['just_id']] - $val['count'];
     }
     $this->renderPartial('todayStorage', array('Products' => $Products, 'products' => $products, 'depId' => $depId));
 }
開發者ID:azizbekvahidov,項目名稱:foods,代碼行數:45,代碼來源:DepRealizeController.php

示例3: createOrNone

 /**
  * @return bool
  */
 public function createOrNone()
 {
     $this->verifyTable();
     if (!Storage::model()->findByAttributes(array('key' => $this->hash()))) {
         $storage = new Storage();
         $storage->key = $this->hash();
         $storage->value = json_encode($this->generateBrief());
         return $storage->save();
     }
     return false;
 }
開發者ID:kilylabs,項目名稱:iwi,代碼行數:14,代碼來源:Iwi.php

示例4: actionCalendarEvents

 public function actionCalendarEvents()
 {
     $items = array();
     $model = Storage::model()->findAll();
     foreach ($model as $value) {
         $items[] = array('id' => $value->storage_id, 'url' => '#');
     }
     echo CJSON::encode($items);
     Yii::app()->end();
 }
開發者ID:azizbekvahidov,項目名稱:foods,代碼行數:10,代碼來源:StorageController.php


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