public function duplicate($id) { DB::startTransaction(); $query = "insert into " . $this->tableName() . " (name, user_id, traffic_source_id, rotate, cloaker_id, type)"; $query .= "select concat(name,' copy') as name, user_id, traffic_source_id, rotate, cloaker_id, type from " . $this->tableName() . " "; $query .= "where campaign_id='" . DB::quote($id) . "'"; if (!DB::query($query)) { DB::rollback(); return false; } $new_id = DB::insertId(); if (!$new_id) { DB::rollback(); return false; } if (!CampaignOfferModel::model()->duplicate($id, $new_id)) { DB::rollback(); return false; } if (!CampaignLPModel::model()->duplicate($id, $new_id)) { DB::rollback(); return false; } if (!CampaignOptionModel::model()->duplicate($id, $new_id)) { DB::rollback(); return false; } if (!SpendingModel::model()->duplicate($id, $new_id)) { DB::rollback(); return false; } DB::commit(); return $new_id; }
public function landingPageRowAction() { if (@$_GET['campaign_lp_id']) { $camplp = CampaignLPModel::model()->getRowFromPk($_GET['campaign_lp_id']); } else { $camplp = CampaignLPModel::model(); } $this->setVar('camplp', $camplp); $this->loadView('tracker/landing_page_row'); }