本文整理汇总了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;
}
示例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();
}