本文整理匯總了PHP中Website::first方法的典型用法代碼示例。如果您正苦於以下問題:PHP Website::first方法的具體用法?PHP Website::first怎麽用?PHP Website::first使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Website
的用法示例。
在下文中一共展示了Website::first方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: manage
/**
* @before _secure, memberLayout
*/
public function manage($website_id)
{
$this->seo(array("title" => "All Triggers for your website", "view" => $this->getLayoutView()));
$view = $this->getActionView();
$website = Website::first(array("id = ?" => $website_id));
$this->_authority($website);
$triggers = Trigger::all(array("website_id = ?" => $website_id), array("*"), "priority", "asc");
$count = count($triggers);
$priorities = array();
for ($i = 0; $i <= $count; ++$i) {
$priorities[] = $i;
}
$view->set(array('actions' => $this->actions, 'trigs' => $this->triggers, 'triggers' => $triggers, 'website' => $website, 'priorities' => $priorities));
}
示例2: removeWebsite
/**
* @before _secure, memberLayout
*/
public function removeWebsite($id)
{
$this->noview();
$website = Website::first(array("id = ?" => $id));
$this->_authority($website);
$trigger = Trigger::all(array("website_id = ?" => $website->id, "user_id = ?" => $this->user->id));
$mongo_db = Registry::get("MongoDB");
$mongo_trigger = $mongo_db->selectCollection("triggers");
$mongo_action = $mongo_db->selectCollection("actions");
$hits = $mongo_db->selectCollection("hits");
foreach ($trigger as $t) {
$action = Action::first(array("trigger_id = ?" => $t->id));
$mongo_trigger->remove(array('trigger_id' => (int) $t->id), array('justOne' => true));
$mongo_action->remove(array('action_id' => (int) $action->id), array('justOne' => true));
$hits->remove(array('trigger_id' => (int) $t->id, 'action_id' => (int) $action->id), array('justOne' => true));
$this->delete('Action', $action->id, false);
$this->delete('Trigger', $t->id, false);
}
$mongo_db->selectCollection("website")->remove(array('website_id' => (int) $website->id), array('justOne' => true));
$mongo_db->selectCollection("logs")->remove(array('website_id' => (int) $website->id));
$this->delete('Website', $website->id);
}