本文整理汇总了PHP中Event::find_by_permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::find_by_permalink方法的具体用法?PHP Event::find_by_permalink怎么用?PHP Event::find_by_permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::find_by_permalink方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_event
protected function load_event($permalink = null)
{
if (!$permalink) {
$permalink = $this->GetData('event_permalink');
}
$event = Event::find_by_permalink($permalink);
if ($event) {
return $event;
} else {
Error404();
}
}
示例2: load_event
protected static function load_event($permalink = null)
{
if (!$permalink) {
$permalink = $_GET['permalink'];
}
$event = Event::find_by_permalink($permalink);
if ($event) {
return $event;
} else {
Error404();
}
}
示例3: load_event
protected static function load_event($permalink = null)
{
if (!$permalink) {
$permalink = $_GET['event_permalink'];
}
$event = Event::find_by_permalink($permalink);
if ($event) {
if (!$event->visible) {
self::restrict("admin");
}
if (!$event->check_user(Site::CurrentUser())) {
Error404();
}
return $event;
} else {
Error404();
}
}
示例4: load_event
protected function load_event($permalink = null)
{
if (!$permalink) {
$permalink = $this->getData('permalink');
}
$event = Event::find_by_permalink($permalink);
if ($event) {
return $event;
} else {
throw new Error404('Unable to find the event');
}
}
示例5: load_event
protected static function load_event($permalink = null)
{
if (!$permalink) {
$permalink = $_GET['permalink'];
}
$event = Event::find_by_permalink($permalink);
if ($event) {
if (!$event->visible) {
if (!Site::CurrentUser()->isAdmin()) {
throw new Error403();
}
}
if (!$event->check_user(Site::CurrentUser())) {
Error404();
}
return $event;
} else {
Error404();
}
}
示例6: intranet_update
public function intranet_update()
{
self::Restrict("intranet");
$event = Event::find_by_permalink($_GET['permalink']);
if (!$event) {
Site::Flash("error", "Unable to find event");
Error404();
}
$event_id = mysql_real_escape_string($event->id);
$id = null;
// Achievements
$result = array();
if (isset($_REQUEST['achievements'])) {
$achievements = unserialize($_REQUEST['achievements']);
foreach ($achievements as $achieve) {
if ($achieve['id']) {
$id = mysql_real_escape_string($achieve['id']);
$achievement = Achievement::find("achievements.event_id = '{$event_id}' AND achievements.intranet_id = '{$id}'");
}
if (!$achievement) {
$achievement = new Achievement();
$achievement->event_id = $event->id;
$achievement->intranet_id = $id;
}
$achievement->name = $achieve['name'];
$achievement->description = $achieve['description'];
$achievement->image = $achieve['image'];
$success = false;
if ($achievement->save()) {
$success = true;
}
$result[] = array('id' => $id, 'result' => $success, 'achievement' => $achievement);
}
}
$this->assign("result", $result);
// User achievements
UserAchievement::MarkNotUpdated($event_id);
$result = array();
if (isset($_REQUEST['user_achievements'])) {
$user_achievements = unserialize($_REQUEST['user_achievements']);
foreach ($user_achievements as $achieve) {
$id = mysql_real_escape_string($achieve['achievement_id']);
$user_id = mysql_real_escape_string($achieve['user_id']);
$achievement = Achievement::find("achievements.intranet_id = '{$id}' AND achievements.event_id = '{$event_id}'");
if (!$achievement) {
$success = false;
} else {
$achievement_id = mysql_real_escape_string($achievement->id);
$user_achievement = UserAchievement::find("achievements.id = '{$achievement_id}' and users.id = '{$user_id}'");
$success = false;
if (!$user_achievement) {
$user_achievement = new UserAchievement();
$user_achievement->user_id = $user_id;
$user_achievement->achievement_id = $achievement_id;
}
$user_achievement->updated = true;
if ($user_achievement->save()) {
$success = true;
}
}
$result[] = array('id' => $achieve['id'], 'result' => $success, 'user_achievement' => $user_achievement);
}
}
UserAchievement::DestroyNotUpdated();
$this->assign("user_result", $result);
header('Content-Type: text/xml');
$this->render("achievement/intranet_update.tpl", true);
}
示例7: load_event
protected static function load_event($permalink = null, $allowed = false)
{
if (!$permalink) {
$permalink = $_GET['permalink'];
}
$event = Event::find_by_permalink($permalink);
if ($event) {
if (!$allowed && !$event->check_user(Site::CurrentUser())) {
Error404();
}
if ($event->active) {
return $event;
} else {
Site::Flash("error", "It is not possible to book for this event");
Redirect($event->permalink);
}
} else {
Error404();
}
}
示例8: database_connect
database_connect();
Site::init();
// Flash Messages
if (isset($_SESSION['flash'])) {
$site['flash'] = $_SESSION['flash'];
unset($_SESSION['flash']);
}
// Dispatcher, use .htaccess to set up external 'nice' URLs
if (isset($_GET['error'])) {
if ($_GET['error'] == 403) {
throw new Error403();
} elseif ($_GET['error'] == 404) {
throw new Error404();
}
} elseif (isset($_GET['generic']) and isset($_GET['permalink']) and $_GET['generic'] == 1) {
$event = Event::find_by_permalink($_GET['permalink']);
if ($event) {
$_GET['controller'] = "event";
$_GET['action'] = "show";
} else {
$_GET['controller'] = "content";
$_GET['action'] = "show";
}
}
if (isset($_GET['controller'])) {
$fail = true;
if (!isset($_GET['action'])) {
$_GET['action'] = "index";
}
$controller = str_replace(chr(0), '', $_GET['controller']);
$controller = str_replace("_", "", $controller);