本文整理汇总了PHP中Position::create_position方法的典型用法代码示例。如果您正苦于以下问题:PHP Position::create_position方法的具体用法?PHP Position::create_position怎么用?PHP Position::create_position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::create_position方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: livecdcreateAction
function livecdcreateAction()
{
if (!defined("NOTIF_OFF")) {
//Lets keep liveCD screens private for now
define("NOTIF_OFF", 1);
}
$this->setTitle('Screen Creation');
$screen = new Screen();
//Defaults for live cds
/*
$default_template = 22;
$default_subscriptions[73][] = 0;
$default_subscriptions[74][] = 1;
$default_subscriptions[74][] = 30;
$default_subscriptions[75][] = 8;
$default_subscriptions[75][] = 11;
*/
if (!isset($default_template) || !isset($default_subscriptions) || !is_array($default_subscriptions)) {
$this->flash('Live CD support has not been configured yet. Please contact an administrator.', 'error');
redirect_to(ADMIN_URL);
}
if ($screen->create_screen($_POST[screen][name], $_POST[screen][group], $_POST[screen][location], $_POST[screen][mac_inhex], $_POST[screen][width], $_POST[screen][height], $default_template, 1)) {
//Now setup some sample subscriptions
foreach ($default_subscriptions as $field_id => $subscriptions) {
foreach ($subscriptions as $feed_id) {
$pos = new Position();
$pos->create_position($screen->id, $feed_id, $field_id);
}
}
redirect_to(ROOT_URL . '/?mac=' . $_POST[screen][mac_inhex] . '&w=' . $_POST[screen][width] . '&h=' . $_POST[screen][height] . '&livecd=1');
} else {
$this->flash('The screen creation failed. ' . 'Please check all fields and try again; contact an administrator if all else fails.', 'error');
redirect_to(ADMIN_URL . '/screens/livecd?mac=' . $_POST[screen][mac_inhex] . '&w=' . $_POST[screen][width] . '&h=' . $_POST[screen][height] . '&livecd=1');
}
}
示例2: Position
function add_feed($feed_id_in){
if($this->screen_set){
if(is_array($this->screen_pos))
foreach($this->screen_pos as $pos){
if($pos->feed_id == $feed_id_in){
return true; //The mapping already exists. Someone cannot see that, maybe they are using an iphone and the screen is tiny. dumb iphone
}
}
$new_pos = new Position();
if($new_pos->create_position($this->screen_id, $feed_id_in, $this->id)){
$this->screen_pos[] = $new_pos;
$notify = new Notification();
$notify->notify('screen', $this->screen_id, 'feed', $feed_id_in, 'subscribe');
return true;
} else {
return false;
}
} else {
return false; //No screen = no fun :-(
}
}