当前位置: 首页>>代码示例>>PHP>>正文


PHP Value::model方法代码示例

本文整理汇总了PHP中Value::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Value::model方法的具体用法?PHP Value::model怎么用?PHP Value::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Value的用法示例。


在下文中一共展示了Value::model方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $this->loadModel($id)->delete();
     AttributeDescription::model()->deleteAll('attribute_id=' . $id);
     $Attribute2value = $this->loadAttrToValModel('attribute_id=' . $id);
     foreach ($Attribute2value as $record) {
         Value::model()->deleteAll('value_id=' . $record['value_id']);
         ValueDescription::model()->deleteAll('value_id=' . $record['value_id']);
     }
     Attribute2value::model()->deleteAll('attribute_id=' . $id);
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax']))
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
 }
开发者ID:Kostiantin,项目名称:floors,代码行数:19,代码来源:AttributeController.php

示例2: actionexcelFileOutput14

 public function actionexcelFileOutput14($id, $issueId)
 {
     Yii::import('ext.phpexcel.XPHPExcel');
     $columnCont = 1;
     $rowCont = 1;
     $newsheet = XPHPExcel::createPHPExcel();
     $element = Element::model()->findByPk($id);
     $i = 4;
     $r = 0;
     $resCol = Value::model()->findAll("elementId={$id}  and colonne=1");
     foreach ($element->columns as $colonne) {
         $newsheet->getActiveSheet()->setCellValueByColumnAndRow($columnCont, 1, $colonne->value);
         $i++;
         $columnCont++;
     }
     foreach ($element->rows as $row) {
         $rowCont++;
         $newsheet->getActiveSheet()->setCellValueByColumnAndRow(0, $rowCont, $row->value);
         for ($index = 0; $index < $columnCont; $index++) {
             $res = $element->getResultTableForExcel($issueId, $id, $index, $r);
             switch ($res) {
                 case "off":
                     $newsheet->getActiveSheet()->setCellValueByColumnAndRow($index + 1, $r + 2, "No");
                     break;
                 case "checked":
                     $newsheet->getActiveSheet()->setCellValueByColumnAndRow($index + 1, $r + 2, "Yes");
                     break;
                 default:
             }
         }
         $r++;
     }
     $newsheet->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
     $newsheet->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
     $newsheet->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
     $newsheet->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
     $newsheet->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="myfile.xlsx');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($newsheet, 'Excel2007');
     $objWriter->save('php://output');
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:43,代码来源:ElementController.php

示例3: actionexcelComp

 public function actionexcelComp($id, $elementId)
 {
     //issueId and elementId
     $element = Element::model()->findByPk($elementId);
     Yii::import('ext.phpexcel.XPHPExcel');
     $title = Element::model()->findByPk($elementId);
     $newsheet = XPHPExcel::createPHPExcel();
     switch ($element->typeId) {
         case 0:
         case 1:
         case 3:
         case 4:
             $criteria = "elementId={$elementId}";
             $results = Result::model()->findAll($criteria);
             //$results=Result::model()->findAll($title->label);
             $newsheet->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->getStyle('D')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(0, 1, "Issue ID");
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(1, 1, "User");
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(2, 1, "Fill date");
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(3, 1, $title->label);
             $newsheet->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('D')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('A1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getStyle('B1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getStyle('C1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getStyle('D1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
             $newsheet->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
             $newsheet->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
             $newsheet->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
             $cont = 2;
             foreach ($results as $result) {
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(0, $cont, $result->issueId);
                 $issue = $this->loadIssue($result->issueId);
                 $user = Element::model()->getUserForExcel($result->issueId, $elementId);
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(1, $cont, $user);
                 //
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(2, $cont, Yii::app()->dateFormatter->format("HH:mm d/M/y", $result->createTime));
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(3, $cont, $result->value);
                 $cont++;
             }
             $traveler = Traveler::model()->findByPk($issue->travelerId);
             if (isset($issue)) {
                 if (strlen($traveler->name) > 28) {
                     $traveler->name = substr($traveler->name, 0, 28);
                 }
                 $newsheet->getActiveSheet()->setTitle($traveler->name);
             }
             //else throw new CHttpException(403, 'There is a problem with the data');
             header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
             header('Content-Disposition: attachment;filename="myfile.xlsx');
             header('Cache-Control: max-age=0');
             //metada:
             $newsheet->getProperties()->setCreator(Yii::app()->user->username);
             $objWriter = PHPExcel_IOFactory::createWriter($newsheet, 'Excel2007');
             $objWriter->save('php://output');
             break;
         case 5:
             //devuelve el value de result, que es el id de value!!
             //center 1st column
             $newsheet->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $newsheet->getActiveSheet()->getStyle('D')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             //name first column
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(0, 1, "Issue ID");
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(1, 1, "User");
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(2, 1, "Fill date");
             $newsheet->getActiveSheet()->setCellValueByColumnAndRow(3, 1, $title->label);
             //center data cells
             $newsheet->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             $newsheet->getActiveSheet()->getStyle('D')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
             //color
             $newsheet->getActiveSheet()->getStyle('A1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getStyle('B1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getStyle('C1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             $newsheet->getActiveSheet()->getStyle('D1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('AFDBFF');
             //size
             $newsheet->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
             $newsheet->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
             $newsheet->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
             $newsheet->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
             $criteria = "elementId={$elementId}";
             $preresults = Result::model()->findAll($criteria);
             $cont = 2;
             foreach ($preresults as $preresult) {
                 $issue = $this->loadIssue($preresult->issueId);
                 $user = Element::model()->getUserForExcel($preresult->issueId, $elementId);
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(0, $cont, $preresult->issueId);
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(1, $cont, $user);
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(2, $cont, Yii::app()->dateFormatter->format("HH:mm d/M/y", $preresult->createTime));
                 $value = Value::model()->findByPk($preresult->value);
                 $newsheet->getActiveSheet()->setCellValueByColumnAndRow(3, $cont, $value->value);
//.........这里部分代码省略.........
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:101,代码来源:StepController.php

示例4: getUserForBox2

 public function getUserForBox2($issueId = null)
 {
     //var_dump(empty($resultado));
     //$values = $this->values;
     $resultado = "";
     if (is_null($issueId)) {
         return '';
     }
     $criteria = new CDbCriteria();
     $criteria->condition = "issueId = {$issueId} and elementId = {$this->id}";
     $results = Result::model()->findAll($criteria);
     foreach ($results as $result) {
         $label = Value::model()->findByPk($result->value);
         $resultado .= $label->value . ":    " . $result->user->username . ".  " . $result->dateCreated . "\n";
     }
     return $resultado;
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:17,代码来源:Element.php

示例5: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Value the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Value::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:15,代码来源:ValueController.php


注:本文中的Value::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。