Ejemplo n.º 1
1
 /**
  * @return CActiveDataProvider
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('name', $this->name, true);
     return new CActiveDataProvider($this, ['criteria' => $criteria]);
 }
Ejemplo n.º 2
1
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('id_tipo_riesgo', $this->id_tipo_riesgo);
     $criteria->compare('nombre', $this->nombre, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 3
1
 public function displayDataset($ids)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition("id", $ids);
     $datasets = Dataset::model()->findAll($criteria);
     $this->generateFeed($datasets);
 }
Ejemplo n.º 4
1
 /**
  * 生成首页
  *
  */
 public function actionIndex()
 {
     //print_r(Yii::app()->user->getState('username'));
     //先获取当前是否有页码信息
     $pages['pageNum'] = Yii::app()->getRequest()->getParam("pageNum", 1);
     //当前页
     $pages['countPage'] = Yii::app()->getRequest()->getParam("countPage", 0);
     //总共多少记录
     $pages['numPerPage'] = Yii::app()->getRequest()->getParam("numPerPage", 50);
     //每页多少条数据
     $pages['tmstart'] = Yii::app()->getRequest()->getParam("tmstart", date('Ym'));
     //开始月份
     $pages['tmstop'] = Yii::app()->getRequest()->getParam("tmstop", date('Ym'));
     //结束月份
     $pages['srh_service'] = Yii::app()->getRequest()->getParam("srh_service", "");
     //按餐厅名称查询
     $criteria = new CDbCriteria();
     !empty($pages['srh_service']) && $criteria->addCondition('type=' . $pages['srh_service']);
     $criteria->addCondition('`month`>=' . $pages['tmstart']);
     $criteria->addCondition('`month`<=' . $pages['tmstop']);
     $pages['countPage'] = AppBsMoney::model()->count($criteria);
     $criteria->limit = $pages['numPerPage'];
     $criteria->offset = $pages['numPerPage'] * ($pages['pageNum'] - 1);
     $allList = AppBsMoney::model()->findAll($criteria);
     $this->renderPartial('index', array('models' => $allList, 'pages' => $pages), false, true);
 }
 public function run()
 {
     $params = array();
     $criteria = new CDbCriteria();
     //        $criteria->select = array('id,username,fullname,phone,address,status');
     $criteria->select = '*';
     if (isset($this->team_lear_id) and $this->team_lear_id != '') {
         $criteria->addCondition('team_lear_id=' . $this->team_lear_id);
     }
     $criteria->params = $params;
     $total = ATrainingTeam::model()->count($criteria);
     $offset = $this->limit * ($this->page - 1);
     $criteria->limit = $this->limit;
     $criteria->offset = $offset;
     $data = ATrainingTeam::model()->findAll($criteria);
     $listTrainee = array();
     if (!empty($data)) {
         foreach ($data as $item) {
             $listTrainee[] = CJSON::decode(CJSON::encode($item->pls_user));
         }
     }
     $data = $listTrainee;
     $pages = new CPagination($total);
     $pages->pageSize = $this->limit;
     $pages->applyLimit($criteria);
     $this->render($this->view, array('data' => $data, 'pages' => $pages));
 }
Ejemplo n.º 6
1
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id, true);
     $criteria->compare('html', $this->html, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 7
1
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('title', $this->title, true);
     $criteria->compare('catalog_id', $this->catalog_id);
     $criteria->compare('soft_icon', $this->soft_icon, true);
     $criteria->compare('cover_image', $this->cover_image, true);
     $criteria->compare('soft_file', $this->soft_file, true);
     $criteria->compare('language', $this->language, true);
     $criteria->compare('softtype', $this->softtype, true);
     $criteria->compare('os', $this->os, true);
     $criteria->compare('softrank', $this->softrank, true);
     $criteria->compare('softsize', $this->softsize, true);
     $criteria->compare('softlink', $this->softlink, true);
     $criteria->compare('introduce', $this->introduce, true);
     $criteria->compare('content', $this->content, true);
     $criteria->compare('update_time', $this->update_time, true);
     $criteria->compare('create_time', $this->create_time, true);
     $criteria->compare('view_count', $this->view_count);
     $criteria->compare('down_count', $this->down_count);
     $criteria->compare('status', $this->status, true);
     $criteria->compare('tags', $this->tags, true);
     $criteria->compare('seo_title', $this->seo_title, true);
     $criteria->compare('seo_description', $this->seo_description, true);
     $criteria->compare('seo_keywords', $this->seo_keywords, true);
     return new CActiveDataProvider('Soft', array('criteria' => $criteria));
 }
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('name', $this->name, true);
     $criteria->compare('name_en', $this->name_en, true);
     $criteria->compare('non_utf8_name', $this->non_utf8_name, true);
     $criteria->compare('parentid', $this->parentid);
     $criteria->compare('description', $this->description, true);
     $criteria->compare('description_en', $this->description_en, true);
     $criteria->compare('order', $this->order);
     $criteria->compare('active', $this->active);
     $criteria->compare('metadescription', $this->metadescription, true);
     $criteria->compare('metakeywords', $this->metakeywords, true);
     //$criteria->compare('delete',$this->delete);
     $criteria->addCondition("t.delete=0");
     $criteria->compare('createdby', $this->createdby);
     $criteria->compare('createdatetime', $this->createdatetime, true);
     $criteria->compare('lastmodifiedby', $this->lastmodifiedby);
     $criteria->compare('lastupdatedatetime', $this->lastupdatedatetime, true);
     //$criteria->order = 't.createdatetime DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 9
0
 public function search_cabecera($id)
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('hidfactura', $this->hidfactura, true);
     $criteria->compare('item', $this->item, true);
     $criteria->compare('hidkardex', $this->hidkardex, true);
     $criteria->compare('iduser', $this->iduser);
     $criteria->compare('fechacrea', $this->fechacrea, true);
     $criteria->compare('hidalentrega', $this->hidalentrega, true);
     $criteria->compare('identrega', $this->identrega, true);
     $criteria->compare('iddetcompra', $this->iddetcompra, true);
     $criteria->compare('cant', $this->cant);
     $criteria->compare('fechaentrega', $this->fechaentrega, true);
     $criteria->compare('idkardex', $this->idkardex, true);
     $criteria->compare('punitentrega', $this->punitentrega);
     $criteria->compare('codart', $this->codart, true);
     $criteria->compare('cantcompras', $this->cantcompras);
     $criteria->compare('punitcompra', $this->punitcompra);
     $criteria->compare('itemcompra', $this->itemcompra, true);
     $criteria->compare('descri', $this->descri, true);
     $criteria->compare('codentro', $this->codentro, true);
     $criteria->addCondition("hidfactura=:identidad");
     $criteria->params = array(":identidad" => (int) $id);
     $criteria->order = "itemcompra ASC ";
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 10
0
 private function get_data($filter = '', $limit = 5, $offset = 0)
 {
     $criteria = new CDbCriteria();
     if (is_array($filter)) {
         if (isset($filter['application_id'])) {
             $criteria->compare('application_id', $filter['application_id']);
         } else {
             $criteria->addCondition('application_id IS NULL');
         }
         if (isset($filter['project_id'])) {
             $criteria->compare('project_id', $filter['project_id']);
         }
     }
     $count = Notes::model()->count($criteria);
     $criteria->limit = $limit;
     $criteria->offset = $offset;
     $criteria->order = 'date_created DESC';
     $model = Notes::model()->findAll($criteria);
     $data = array();
     //XSS Purifier here
     // $p = new CHtmlPurifier();
     // $p->options = array('URI.AllowedSchemes'=>array(
     //     'http' => true,
     //     'https' => true,
     // ));
     foreach ($model as $row) {
         $data[] = array('note_id' => $row->note_id, 'project_id' => $row->project_id, 'application_id' => $row->application_id, 'notes' => str_replace('<', '&lt', $row->notes), 'date_created' => $row->date_created, 'date_updated' => $row->date_updated, 'created_by' => $row->created_by, 'updated_by' => $row->updated_by);
     }
     return array('data' => $data, 'data_count' => count($data), 'total_count' => $count);
 }
Ejemplo n.º 11
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('Id', $this->Id);
     $criteria->compare('Ext', $this->Ext, true);
     $criteria->compare('Line', $this->Line, true);
     $criteria->compare('Hreg', $this->Hreg, true);
     $criteria->compare('HN', $this->HN, true);
     $criteria->compare('SessNo', $this->SessNo, true);
     $criteria->compare('BegHd', $this->BegHd, true);
     $criteria->compare('HdMode', $this->HdMode, true);
     $criteria->compare('ClaimAcc', $this->ClaimAcc, true);
     $criteria->compare('Payers', $this->Payers, true);
     $criteria->compare('DlzNew', $this->DlzNew, true);
     $criteria->compare('EpoTn', $this->EpoTn, true);
     $criteria->compare('Epounit', $this->Epounit, true);
     $criteria->compare('Hct', $this->Hct, true);
     $criteria->compare('Paychk', $this->Paychk, true);
     $criteria->compare('Amount', $this->Amount, true);
     $criteria->compare('HDCharge', $this->HDCharge, true);
     $criteria->compare('Payrate', $this->Payrate, true);
     $criteria->compare('AddiPay', $this->AddiPay, true);
     $criteria->compare('Payable', $this->Payable, true);
     $criteria->compare('EHS', $this->EHS, true);
     $criteria->compare('BF', $this->BF, true);
     $criteria->compare('CheckCode', $this->CheckCode, true);
     $criteria->compare('Flag', $this->Flag, true);
     $criteria->compare('D_update', $this->D_update, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 12
0
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     $criteria->compare('apartment_id', $this->apartment_id, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => param('adminPaginationPageSize', 20))));
 }
Ejemplo n.º 13
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('type', $this->type, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 14
0
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('LoginID', $this->LoginID);
     $criteria->compare('User', $this->User, true);
     $criteria->compare('Pass', $this->Pass, true);
     $criteria->compare('State', $this->State);
     $criteria->compare('Type', $this->Type);
     $criteria->compare('AreaID', $this->AreaID);
     $criteria->compare('Param', $this->Param);
     $criteria->compare('Comment', $this->Comment, true);
     $criteria->compare('TechComment', $this->TechComment, true);
     $criteria->compare('AddTime', $this->AddTime, true);
     $criteria->compare('LastTime', $this->LastTime, true);
     $criteria->compare('SendInt', $this->SendInt);
     $criteria->compare('Version', $this->Version, true);
     $criteria->compare('AppType', $this->AppType);
     $criteria->compare('AppVer', $this->AppVer, true);
     $criteria->compare('UpdTime', $this->UpdTime, true);
     $criteria->compare('AreaAdmin', $this->AreaAdmin);
     $criteria->compare('PersistCon', $this->PersistCon);
     $criteria->compare('LangID', $this->LangID);
     $criteria->compare('Email', $this->Email, true);
     $criteria->compare('MaxSessions', $this->MaxSessions);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 15
0
 public function search2()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     if (!empty($this->from_date) && empty($this->to_date)) {
         $criteria->condition = "TGL_PENGADAAN>='{$this->from_date}'";
         $criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
         $criteria->compare('STATUS', $this->STATUS, true);
     } else {
         if (empty($this->from_date) && !empty($this->to_date)) {
             $criteria->condition = "TGL_PENGADAAN<='{$this->to_date}'";
             $criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
             $criteria->compare('STATUS', $this->STATUS, true);
         } else {
             if (!empty($this->from_date) && !empty($this->to_date)) {
                 $criteria->condition = "TGL_PENGADAAN>='{$this->from_date}' and TGL_PENGADAAN<='{$this->to_date}'";
                 $criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
                 $criteria->compare('STATUS', $this->STATUS, true);
             } else {
                 $criteria->compare('NAMA_TOKO', $this->NAMA_TOKO, true);
                 $criteria->compare('STATUS', $this->STATUS, true);
             }
         }
     }
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'TGL_PENGADAAN DESC'), 'pagination' => array('pageSize' => '10')));
 }
Ejemplo n.º 16
0
 /**
  * Search the local authorities and return both their address and the address of their social security department
  *
  * @param $term
  */
 public function actionAutoComplete($term)
 {
     $crit = new \CDbCriteria();
     // NOTE: have commented out the address eager loading here due to column ambiguity issues with the relation definitions.
     // need to investigate if this can be solved with the cunning use of scopes on the Contact model or not.
     $crit->with = array('contact' => array('alias' => 'service_contact'), 'commissioning_body', 'commissioning_body.contact', 'type' => array('alias' => 'service_type'), 'commissioning_body.type' => array('alias' => 'body_type'));
     $crit->compare('LOWER(t.name)', strtolower($term), true);
     $crit->compare('LOWER(commissioning_body.name)', strtolower($term), true, 'OR');
     $crit->addColumnCondition(array('service_type.shortname' => 'SSD'));
     $crit->addColumnCondition(array('body_type.shortname' => 'LA'));
     $crit->order = 'commissioning_body.name, t.name';
     $results = array();
     $found_bodies = array();
     foreach (\CommissioningBodyService::model()->findAll($crit) as $cbs) {
         $body = $cbs->commissioning_body;
         $found_bodies[] = $body->id;
         $results[] = array('id' => 'service' . $cbs->id, 'value' => $cbs->name . " ({$body->name})", 'service' => array('id' => $cbs->id, 'name' => $cbs->name, 'address' => $cbs->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $cbs->contact->primary_phone), 'body' => array('id' => $body->id, 'name' => $body->name, 'address' => $body->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $body->contact->primary_phone));
     }
     $body_crit = new \CDbCriteria();
     $body_crit->with = array('type', 'contact', 'contact.correspondAddress');
     $body_crit->compare('LOWER(t.name)', strtolower($term), true);
     $body_crit->addNotInCondition('t.id', $found_bodies);
     $body_crit->addColumnCondition(array('type.shortname' => 'LA'));
     foreach (\CommissioningBody::model()->findAll($body_crit) as $body) {
         $results[] = array('id' => 'body' . $body->id, 'value' => $body->name, 'body' => array('id' => $body->id, 'name' => $body->name, 'address' => $body->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $body->contact->primary_phone));
     }
     echo json_encode($results);
 }
 public function actionExportar()
 {
     $clave = Configuraciones::model()->findByPk(1);
     if ($_POST['clave'] == $clave->super_usuario) {
         if ($_POST['filtro'] == 1) {
             $laFechaDesde = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_desde']);
             $laFechaHasta = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_hasta']);
             $attribs = array();
             $criteria = new CDbCriteria(array('order' => 'id DESC'));
             $criteria->addBetweenCondition('fecha_sola', $laFechaDesde, $laFechaHasta);
             $rows = MedicamentosBiologicos::model()->findAllByAttributes($attribs, $criteria);
         } else {
             $rows = MedicamentosBiologicos::model()->findAll();
         }
         // Export it
         $this->toExcel($rows, array('id::ID', 'medicamento'));
     } else {
         Yii::app()->user->setFlash('error', "Clave incorrecta para realizar la exportación.");
         $model = new MedicamentosBiologicos('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['MedicamentosBiologicos'])) {
             $model->attributes = $_GET['MedicamentosBiologicos'];
         }
         $this->render('admin', array('model' => $model));
     }
 }
Ejemplo n.º 18
0
 public function actionGetimg()
 {
     if (isset($_POST['data'])) {
         $data = $_POST['data'];
         $model = new Image();
         $criteria = new CDbCriteria();
         if ($data[0]) {
             $criteria->addCondition("is_show=1 and pid={$data['0']} and id<{$data['1']}");
         } else {
             $criteria->addCondition("is_show=1 and id<{$data['1']}");
         }
         $criteria->order = 'id desc';
         $criteria->limit = 6;
         $imgs = $model->findAll($criteria);
         if (!$imgs) {
             echo 0;
             exit;
         }
         $html = array();
         if ($imgs) {
             foreach ($imgs as $one) {
                 $html[] = "<div class='item'><div class='animate-box bounceIn animated'>\r\n\t\t\t\t\t<a href='javascript:;' class='image-popup fh5co-board-img' title='{$one->title}'><img src='http://7xssk6.com2.z0.glb.clouddn.com/{$one->img}' alt='s-nice'></a>\t\t\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class='fh5co-desc'>{$one->des}</div></div>";
             }
             $html[] = "<p style='display:none' id='imgid'>{$one->id}</p>";
         }
         $html = json_encode($html);
         if ($html) {
             echo $html;
             exit;
         } else {
             echo 0;
             exit;
         }
     }
 }
Ejemplo n.º 19
0
 /**
  * Duplicated from the admin controller to give a user list.
  *
  * @TODO: There's a method on the UserController that could be used, so would be worth consolidating)
  */
 public function actionUserFind()
 {
     $res = array();
     if (\Yii::app()->request->isAjaxRequest && !empty($_REQUEST['search'])) {
         $criteria = new \CDbCriteria();
         $criteria->compare('LOWER(username)', strtolower($_REQUEST['search']), true, 'OR');
         $criteria->compare('LOWER(first_name)', strtolower($_REQUEST['search']), true, 'OR');
         $criteria->compare('LOWER(last_name)', strtolower($_REQUEST['search']), true, 'OR');
         $words = explode(' ', $_REQUEST['search']);
         if (count($words) > 1) {
             // possibly slightly verbose approach to checking first and last name combinations
             // for searches
             $first_criteria = new \CDbCriteria();
             $first_criteria->compare('LOWER(first_name)', strtolower($words[0]), true);
             $first_criteria->compare('LOWER(last_name)', strtolower(implode(' ', array_slice($words, 1, count($words) - 1))), true);
             $last_criteria = new \CDbCriteria();
             $last_criteria->compare('LOWER(first_name)', strtolower($words[count($words) - 1]), true);
             $last_criteria->compare('LOWER(last_name)', strtolower(implode(' ', array_slice($words, 0, count($words) - 2))), true);
             $first_criteria->mergeWith($last_criteria, 'OR');
             $criteria->mergeWith($first_criteria, 'OR');
         }
         foreach (\User::model()->findAll($criteria) as $user) {
             $res[] = array('id' => $user->id, 'label' => $user->getFullNameAndTitle(), 'value' => $user->getFullName(), 'username' => $user->username);
         }
     }
     echo \CJSON::encode($res);
 }
Ejemplo n.º 20
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('Id', $this->Id);
     $criteria->compare('ProjectType', $this->ProjectType, true);
     $criteria->compare('Firstname', $this->Firstname, true);
     $criteria->compare('Lastname', $this->Lastname, true);
     $criteria->compare('Phone', $this->Phone, true);
     $criteria->compare('AlternatePhone', $this->AlternatePhone, true);
     $criteria->compare('Email', $this->Email, true);
     $criteria->compare('StreetAddress', $this->StreetAddress, true);
     $criteria->compare('City', $this->City, true);
     $criteria->compare('State', $this->State, true);
     $criteria->compare('Zip', $this->Zip, true);
     $criteria->compare('SquareFoot', $this->SquareFoot, true);
     $criteria->compare('Budget', $this->Budget, true);
     $criteria->compare('ProjectDetails', $this->ProjectDetails, true);
     $criteria->compare('ProjectReason', $this->ProjectReason, true);
     $criteria->compare('Start', $this->Start, true);
     $criteria->compare('Age', $this->Age, true);
     $criteria->compare('IsOwn', $this->IsOwn);
     $criteria->compare('TimeToContact', $this->TimeToContact, true);
     $criteria->compare('IsFinancing', $this->IsFinancing);
     $criteria->compare('IpAddress', $this->IpAddress, true);
     $criteria->compare('IsFreePage', $this->IsFreePage);
     $criteria->compare('Affiliate', $this->Affiliate, true);
     $criteria->compare('MyPageAffiliate', $this->MyPageAffiliate, true);
     $criteria->compare('IsSentToRenovExperts', $this->IsSentToRenovExperts);
     $criteria->compare('Created', $this->Created, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 21
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $this->setPageTitle('通知');
     $type = Yii::app()->request->getQuery('type');
     $type_arr = Notify::model()->type_arr;
     $user = new User();
     $notifys = array();
     $uid = Yii::app()->user->id;
     $model = new Notify();
     //初始化
     $criteria = new CDbCriteria();
     $criteria->order = 'ctime';
     $criteria->condition = "t.uid=:uid";
     $criteria->params = array(':uid' => $uid);
     if (!array_key_exists($type, $type_arr)) {
         $type = 'all';
     }
     if ($type != 'all') {
         $condition = "cate = '{$cate}'";
         $criteria->addCondition($condition);
     }
     //取得数据总数,分页显示
     $total = $model->count($criteria);
     $pages = new CPagination($total);
     $pages->pageSize = 20;
     $pages->applyLimit($criteria);
     //获取数据集
     $notifys = $model->findAll($criteria);
     $data = array('type' => $type, 'type_arr' => $type_arr, 'notifys' => $notifys, 'user' => $user, 'pages' => $pages);
     $this->render('index', $data);
 }
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->with = 'patient';
     $criteria->compare('id', $this->id);
     $criteria->compare('patient_id', $this->patient_id);
     $criteria->compare('plan_more_children', $this->plan_more_children, true);
     $criteria->compare('reason_for_practicing_fp', $this->reason_for_practicing_fp, true);
     $criteria->compare('type_of_acceptor', $this->type_of_acceptor, true);
     $criteria->compare('previous_method_used', $this->previous_method_used, true);
     $criteria->compare('spouse_name', $this->spouse_name, true);
     $criteria->compare('spouse_date_of_birth', $this->spouse_date_of_birth, true);
     $criteria->compare('spouse_highest_education', $this->spouse_highest_education, true);
     $criteria->compare('spouse_occupation', $this->spouse_occupation, true);
     $criteria->compare('average_monthly_income', $this->average_monthly_income, true);
     $criteria->compare('method_accepted', $this->method_accepted, true);
     $criteria->compare('other_method_accepted', $this->other_method_accepted, true);
     $criteria->compare('chosen_method', $this->chosen_method, true);
     $criteria->compare('fps_date', $this->fps_date, true);
     $criteria->compare('patient_family_name', $this->patient_family_name, true);
     $criteria->compare('patient_first_name', $this->patient_family_name, true, 'OR');
     $criteria->compare('patient_middle_name', $this->patient_family_name, true, 'OR');
     $sort = new CSort();
     $sort->attributes = array('patient_family_name' => array('asc' => 'patient_family_name', 'desc' => 'patient_family_name desc'), '*');
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => $sort));
 }
Ejemplo n.º 23
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id, true);
     $criteria->compare('hidinventario', $this->hidinventario, true);
     $criteria->compare('fecha', $this->fecha, true);
     $criteria->compare('codestado', $this->codestado, true);
     $criteria->compare('descri', $this->descri, true);
     $criteria->compare('mobs', $this->mobs, true);
     $criteria->compare('usuario', $this->usuario, true);
     //$criteria->compare('codep',$this->codep,true);
     /*$criteria->together  =  true;
     		$criteria->with = array('estado','inventario');*/
     /*	$criteria->with = array('inventario');
     		if($this->inventario_descripcion){
     				$criteria->compare('inventario.descripcion',$this->inventario_descripcion,true);
     				
     			}
     			
     			if($this->inventario_codigosap){
     			$criteria->compare('inventario.codigosap',$this->inventario_codigosap,true);
     			}
     		if($this->inventario_codigoaf){
     			$criteria->compare('inventario.codigoaf',$this->inventario_codigoaf,true);
     			}
     
     			if($this->inventario_codep){
     			$criteria->compare('inventario.codep',$this->inventario_codep,true);
     			}
     			*/
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => 20)));
 }
Ejemplo n.º 24
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.name', $this->name, true);
     $criteria->with = array('category');
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 't.name'), 'pagination' => array('pageSize' => 50)));
 }
Ejemplo n.º 25
0
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('name', $this->name, true);
     $criteria->compare('value', $this->value, true);
     return new CActiveDataProvider(get_class($this), array('criteria' => $criteria));
 }
Ejemplo n.º 26
0
 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             Comment::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Comment::model()->updateAll(['status' => Comment::STATUS_SHOW], $criteria);
             break;
         case 'hide':
             //隐藏
             Comment::model()->updateAll(['status' => Comment::STATUS_HIDE], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
Ejemplo n.º 27
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id);
     $criteria->compare('pad1', $this->pad1, true);
     $criteria->compare('pad2', $this->pad2, true);
     $criteria->compare('pad3', $this->pad3, true);
     $criteria->compare('pad4', $this->pad4, true);
     $criteria->compare('pad5', $this->pad5, true);
     $criteria->compare('pad6', $this->pad6, true);
     $criteria->compare('pad7', $this->pad7, true);
     $criteria->compare('pad8', $this->pad8, true);
     $criteria->compare('pad9', $this->pad9, true);
     $criteria->compare('pad10', $this->pad10, true);
     $criteria->compare('pad11', $this->pad11, true);
     $criteria->compare('pad12', $this->pad12, true);
     $criteria->compare('pad13', $this->pad13, true);
     $criteria->compare('pad14', $this->pad14, true);
     $criteria->compare('pad15', $this->pad15, true);
     $criteria->compare('pad16', $this->pad16, true);
     $criteria->compare('pad17', $this->pad17, true);
     $criteria->compare('questionnaires_id', $this->questionnaires_id);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
Ejemplo n.º 28
0
 public function actionIndex($is_product = 1)
 {
     if (!empty($_POST)) {
         $is_new_product = $is_product;
         $images = CUploadedFile::getInstancesByName('images');
         if (isset($images) && count($images) > 0) {
             // go through each uploaded image
             foreach ($images as $image => $pic) {
                 $model = new Slides();
                 $imageType = explode('.', $pic->name);
                 $imageType = $imageType[count($imageType) - 1];
                 $imageName = md5(uniqid()) . '.' . $imageType;
                 if ($pic->saveAs(Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName)) {
                     $model->image = $imageName;
                     $model->name = $pic->name;
                     $model->is_product = $is_new_product;
                     $model->save();
                     Yii::app()->user->setFlash('success', translate('Thêm thành công.'));
                 }
                 // handle the errors here, if you want
             }
         }
         PIUrl::createUrl('/admin/slides/index', array('is_product' => $is_product));
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition("is_product= {$is_product}");
     $criteria->order = 'id DESC';
     $count = Slides::model()->count($criteria);
     $pages = new CPagination($count);
     // results per page
     $pages->pageSize = 6;
     $pages->applyLimit($criteria);
     $model = Slides::model()->findAll($criteria);
     $this->render('index', compact('model', 'pages'));
 }
Ejemplo n.º 29
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $criteria->compare('umr_id', $this->umr_id);
     $criteria->compare('umr_name', $this->umr_name, true);
     $criteria->compare('umr_product_type', $this->umr_product_type);
     $criteria->compare('umr_type', $this->umr_type);
     $criteria->compare('umr_size', $this->umr_size, true);
     $criteria->compare('umr_fit', $this->umr_fit);
     $criteria->compare('umr_collor', $this->umr_collor);
     $criteria->compare('umr_shirt_length', $this->umr_shirt_length);
     $criteria->compare('umr_long_sleeve', $this->umr_long_sleeve);
     $criteria->compare('umr_short_sleeve', $this->umr_short_sleeve);
     $criteria->compare('umr_shoulder', $this->umr_shoulder);
     $criteria->compare('umr_chest_half', $this->umr_chest_half);
     $criteria->compare('umr_mid_section_half', $this->umr_mid_section_half);
     $criteria->compare('umr_hip_half', $this->umr_hip_half);
     $criteria->compare('umr_short_sleeve_opening', $this->umr_short_sleeve_opening);
     $criteria->compare('umr_arm_half', $this->umr_arm_half);
     $criteria->compare('umr_cuff', $this->umr_cuff);
     $criteria->compare('umr_height', $this->umr_height);
     $criteria->compare('umr_feet', $this->umr_feet);
     $criteria->compare('umr_weight', $this->umr_weight);
     $criteria->compare('umr_describe_arms', $this->umr_describe_arms);
     $criteria->compare('umr_wear_shirt', $this->umr_wear_shirt);
     $criteria->compare('umr_prefer_wear', $this->umr_prefer_wear);
     $criteria->compare('umr_stomach', $this->umr_stomach);
     $criteria->compare('umr_hip', $this->umr_hip);
     $criteria->compare('umr_chest', $this->umr_chest);
     $criteria->compare('umr_created', $this->umr_created, true);
     $criteria->compare('umr_modified', $this->umr_modified, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
 public function actionIndex($id)
 {
     $criteria = new CDbCriteria();
     $criteria->compare('event_id', $id);
     $dataProvider = new CActiveDataProvider('Moderate', ['criteria' => $criteria]);
     $this->render('index', ['dataProvider' => $dataProvider]);
 }