Пример #1
0
 public function __construct($turnBack = 10, $condition = array())
 {
     $publicDay = date('Y-m-d');
     //$publicDay = '2012-10-20';
     $txt = '';
     $turnBackDay = date("Y-m-d", strtotime("-" . $turnBack . " day", strtotime($publicDay)));
     $rsCon = Pond::find()->all();
     foreach ($rsCon as $item) {
         $txt = $txt . $item->tags;
     }
     $txt = '##@' . $txt . '##@';
     $txt = str_replace(array(', ,', ',,'), ',', $txt);
     $txt = str_replace(array('##@,', ',##@'), '', $txt);
     //$txt = 'พี่ปลาอายุ40,พี่ปลาอายุ40,test2,test3 ,test4,พี่ปลาอายุ50,พี่ปลาอายุ50,test2,พี่ปลาอายุ40,พี่ปลาอายุ40,test5,test3,พี่ปลาอายุ50,พี่ปลาอายุ50,พี่ปลาอายุ50';
     $arTag = explode(',', $txt, -1);
     foreach ($arTag as $key => $val) {
         $arTag[$key] = trim($val);
     }
     $countValAr = array_count_values($arTag);
     arsort($countValAr);
     $targetArray = array();
     $icount = 0;
     foreach ($countValAr as $key => $value) {
         $targetArray[] = $key;
         if ($icount >= 9) {
             break;
         }
         $icount = $icount + 1;
     }
     $this->arTagCount = $countValAr;
     $this->arTagResult = $targetArray;
 }
Пример #2
0
 public function actionIndex()
 {
     $arrPorn = [];
     $objTypelist = Typelist::find()->all();
     foreach ($objTypelist as $dataTypelist) {
         //$arrTypelist[] =
         $objPond = Pond::find()->andwhere("status = 1")->andwhere(['type' => $dataTypelist->id])->all();
         foreach ($objPond as $dataPond) {
             $arrPorn[] = ['typeId' => $dataTypelist->id, 'typelist' => $dataTypelist, 'title' => $dataPond->title, 'larvae' => $dataPond->larvae];
         }
     }
     $this->layout = 'layoutstyle';
     return $this->render('index', ['arrPorn' => $arrPorn]);
 }
Пример #3
0
 private function pondDelete()
 {
     $identity = \Yii::$app->user->getIdentity();
     $currentTs = time();
     $deleted = 0;
     $arrIds = \Yii::$app->request->post('idCheck', NULL);
     if (empty($arrIds)) {
         $arrIds = \Yii::$app->request->get('idCheck', NULL);
     }
     if (is_array($arrIds) && !empty($arrIds)) {
         foreach ($arrIds as $lst) {
             $queryPond = Pond::find();
             $Food = $queryPond->where(['id' => $lst])->one()->delete();
             $deleted = $deleted + 1;
         }
         if ($deleted > 0) {
             Ui::setMessage("ลบข้อมูลจำนวน  {$deleted} รายการ" + "บันทึกข้อมูลสำเร็จ");
         } else {
             Ui::setMessage('ไม่มีข้อมูลถูกลบ');
         }
     }
 }