當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AdminConfigBuilder::keyTime方法代碼示例

本文整理匯總了PHP中Admin\Builder\AdminConfigBuilder::keyTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP AdminConfigBuilder::keyTime方法的具體用法?PHP AdminConfigBuilder::keyTime怎麽用?PHP AdminConfigBuilder::keyTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Admin\Builder\AdminConfigBuilder的用法示例。


在下文中一共展示了AdminConfigBuilder::keyTime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: editAdv

 public function editAdv()
 {
     $advModel = D('Common/Adv');
     $aId = I('id', 0, 'intval');
     if ($aId != 0) {
         $adv = $advModel->find($aId);
         $aPosId = $adv['pos_id'];
     } else {
         $aPosId = I('get.pos_id', 0, 'intval');
     }
     $advPosModel = D('Common/AdvPos');
     $pos = $advPosModel->find($aPosId);
     if (IS_POST) {
         $adv['title'] = I('title', '', 'text');
         $adv['pos_id'] = $aPosId;
         $adv['url'] = I('url', '', 'text');
         $adv['sort'] = I('sort', 1, 'intval');
         $adv['status'] = I('status', 1, 'intval');
         $adv['create_time'] = I('create_time', '', 'intval');
         $adv['start_time'] = I('start_time', '', 'intval');
         $adv['end_time'] = I('end_time', '', 'intval');
         $adv['target'] = I('target', '', 'text');
         S('adv_list_' . $pos['name'] . $pos['path'], null);
         if ($pos['type'] == 2) {
             //todo 多圖
             $aTitles = I('title', '', 'text');
             $aUrl = I('url', '', 'text');
             $aSort = I('sort', '', 'intval');
             $aStartTime = I('start_time', '', 'intval');
             $aEndTime = I('end_time', '', 'intval');
             $aTarget = I('target', '', 'text');
             $added = 0;
             $advModel->where(array('pos_id' => $aPosId))->delete();
             foreach (I('pic', 0, 'intval') as $key => $v) {
                 $data['pic'] = $v;
                 $data['target'] = $aTarget[$key];
                 $adv_temp['title'] = $aTitles[$key];
                 $adv_temp['pos_id'] = $adv['pos_id'];
                 $adv_temp['url'] = $aUrl[$key];
                 $adv_temp['sort'] = $aSort[$key];
                 $adv_temp['status'] = 1;
                 $adv_temp['create_time'] = time();
                 $adv_temp['start_time'] = $aStartTime[$key];
                 $adv_temp['end_time'] = $aEndTime[$key];
                 $adv_temp['target'] = $aTarget[$key];
                 $adv_temp['data'] = json_encode($data);
                 $result = $advModel->add($adv_temp);
                 if ($result !== false) {
                     $added++;
                 }
                 //todo添加
             }
             $this->success('成功改動' . $added . '個廣告。');
         } else {
             switch ($pos['type']) {
                 case 1:
                     //todo 單圖
                     $data['pic'] = I('pic', 0, 'intval');
                     $data['target'] = I('target', 0, 'text');
                     break;
                 case 3:
                     $data['text'] = I('text', '', 'text');
                     $data['text_color'] = I('text_color', '', 'text');
                     $data['text_font_size'] = I('text_font_size', '', 'text');
                     $data['target'] = I('target', 0, 'text');
                     //todo 文字
                     break;
                 case 4:
                     //todo 代碼
                     $data['code'] = I('code', '', '');
                     break;
             }
             $adv['data'] = json_encode($data);
             if ($aId == 0) {
                 $result = $advModel->add($adv);
             } else {
                 $adv['id'] = $aId;
                 $result = $advModel->save($adv);
             }
             if ($result === false) {
                 $this->error('保存失敗。');
             } else {
                 $this->success('保存成功。');
             }
         }
     } else {
         //快速添加廣告位邏輯
         //todo 快速添加
         $builder = new AdminConfigBuilder();
         $adv['pos'] = $pos['title'] . '——' . $pos['name'] . '——' . $pos['path'];
         $adv['pos_id'] = $aPosId;
         $builder->keyReadOnly('pos', '所屬廣告位');
         $builder->keyReadOnly('pos_id', '廣告位ID');
         $builder->keyId()->keyTitle('title', '廣告說明');
         $builder->title($pos['title'] . '設置——' . $advPosModel->switchType($pos['type']));
         $builder->keyTime('start_time', '開始生效時間', '不設置則立即生效')->keyTime('end_time', '失效時間', '不設置則一直有效')->keyText('sort', '排序')->keyCreateTime()->keyStatus();
         $builder->buttonSubmit();
         $data = json_decode($adv['data'], true);
         if (!empty($data)) {
             $adv = array_merge($adv, $data);
//.........這裏部分代碼省略.........
開發者ID:naliduo,項目名稱:Lightweight-social-platform,代碼行數:101,代碼來源:AdvController.class.php


注:本文中的Admin\Builder\AdminConfigBuilder::keyTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。