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