当前位置: 首页>>代码示例>>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;未经允许,请勿转载。