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


PHP Campaign::findByPk方法代码示例

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


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

示例1: getAttachedOrders

 public function getAttachedOrders()
 {
     // grab attachment campaign info
     $attachedCampaigns = CampaignAttachs::getAttachedByCampaign($this->campaign_id, false);
     foreach ($attachedCampaigns as &$ac) {
         $campaingModel = new Campaign();
         $c = $campaingModel->findByPk($ac['campaign_attach_id']);
         if ($c) {
             $ac['campaign_attach_name_format'] = '[' . $c->campaign_id . '] ' . $c->campaign_name;
         }
         // is there already an order for the camp?  if so build order details
         $result = self::getOrderByParent($ac['campaign_attach_id'], $this->order_id);
         if (!empty($result)) {
             // doing this results in the instance of $this being reset to the attached order
             //$o = Order::model()->fillFromDbPk($result);
             $o = new Order();
             $o->fillFromDbPk($result);
             $ac['order_id'] = $o->getorder_id_name_link();
             $ac['status'] = $o->getstatus_image();
             $ac['created'] = $o->getcreated_formatted();
             unset($o);
         }
     }
     return $attachedCampaigns;
 }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: deleteAction

 function deleteAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = FALSE;
     foreach ($modelsID as $id) {
         $model = new Campaign();
         $model->model_uset_id = $this->user->user_id;
         if ($model->findByPk($id)) {
             // if beforeDelete() returns an error, indicate this to the user
             if (!$model->delete($id)) {
                 $errors = TRUE;
             }
         } else {
             $errors = TRUE;
         }
         if ($model->getErrors()) {
             $errors = TRUE;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('campaign_no_deleted'));
         } else {
             Message::echoJsonSuccess(__('campaign_deleted'));
         }
     }
     $this->redirect();
 }
开发者ID:,项目名称:,代码行数:31,代码来源:


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