コード例 #1
0
ファイル: SearchController.php プロジェクト: riccoyu/BugFree
 public function actiongetPreNextId()
 {
     $preId = '';
     $nextId = '';
     $preDisabled = '';
     $nextDisabled = '';
     $needToConfirmStr = '$needToConfirm = false;';
     $id = (int) $_GET['id'];
     $infoType = $_GET['type'];
     $productId = (int) $_GET['product_id'];
     $preNextSql = Yii::app()->user->getState($productId . '_' . $infoType . '_prenextsql');
     if (isset($id) && isset($preNextSql)) {
         $idSearchResult = Yii::app()->db->createCommand($preNextSql)->queryAll();
         list($preId, $nextId) = InfoService::getPreNextValue($idSearchResult, $id);
     }
     if ('' == $preId) {
         $preDisabled = 'disabled';
     }
     if ('' == $nextId) {
         $nextDisabled = 'disabled';
     }
     $listStr = CHtml::button(Yii::t('Common', 'Previous') . '(P)', array('onclick' => $needToConfirmStr . 'location.href="' . Yii::app()->createUrl('info/edit', array('type' => $infoType, 'id' => $preId)) . '"', 'class' => 'btn', 'disabled' => $preDisabled, 'accesskey' => 'P'));
     $listStr .= CHtml::button(Yii::t('Common', 'Next') . '(N)', array('onclick' => $needToConfirmStr . 'location.href="' . Yii::app()->createUrl('info/edit', array('type' => $infoType, 'id' => $nextId)) . '"', 'class' => 'btn', 'disabled' => $nextDisabled, 'accesskey' => 'N'));
     echo $listStr;
 }