本文整理汇总了PHP中Block::allUserIdsWithBlockingRelationships方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::allUserIdsWithBlockingRelationships方法的具体用法?PHP Block::allUserIdsWithBlockingRelationships怎么用?PHP Block::allUserIdsWithBlockingRelationships使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::allUserIdsWithBlockingRelationships方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateFor
public static function updateFor($user_id)
{
$blocks = Block::allUserIdsWithBlockingRelationships($user_id);
$q = Doctrine_Query::create()->update("Autofinger")->set("updated", 1)->where("interest = ?", $user_id)->andWhereNotIn("owner", $blocks);
return $q->execute();
}
示例2: get_just_updated
/**
* Get a link to the most recently updated plan.
* @return Hyperlink
*/
function get_just_updated()
{
// Get the most recently updated plan
$q = Doctrine_Query::create()->select("userid, username")->from("Accounts")->where("username != 'test'")->andWhereNotIn("userid", Block::allUserIdsWithBlockingRelationships(User::id()))->orderBy("changed DESC")->limit(1);
//return the results of the query
$new_plans = $q->fetchOne();
// Get the appropriate URI for a plan link
$temp = new PlanLink($new_plans["username"]);
// But we want a generic Hyperlink, so it can be styled separately.
return new Hyperlink('justupdatedlink', true, $temp->href, $new_plans["username"]);
}
示例3: SessionBroker
<?php
/**
* Redirects a user to a random plan.
*/
require_once 'Plans.php';
new SessionBroker();
require 'functions-main.php';
if (User::logged_in()) {
$ids_to_hide = Block::allUserIdsWithBlockingRelationships(User::id());
array_push($ids_to_hide, User::id());
} else {
$ids_to_hide = array();
}
$random_query = Doctrine_Query::create()->select('a.username')->from('Accounts a')->leftJoin('a.Plan p')->where('LENGTH(p.edit_text) != 0')->andWhere('changed > DATE_SUB(NOW(), INTERVAL 1 YEAR)')->andWhereNotIn('a.userid', $ids_to_hide);
$offset = rand(0, $random_query->count() - 1);
$random_user = $random_query->offset($offset)->limit(1)->fetchOne();
header("Location: read.php?searchname=" . $random_user->username);
示例4: AlertText
$err = new AlertText("Plan [{$mysearch}] does not exist. Please check your spelling.", 'Search failed');
$thispage->append($err);
$donotsearch = true;
} else {
$plansearchname = "[" . $mysearch . "]";
$mysearch = $plansearchname;
$donotsearch = false;
}
}
//if planlove
if (!$donotsearch) {
$mysearch = preg_replace("/\\&/", "&", $mysearch);
$mysearch = preg_replace("/\\</", "<", $mysearch);
$mysearch = preg_replace("/\\>/", ">", $mysearch);
$mysearch = preg_quote($mysearch);
$ids_to_hide = Block::allUserIdsWithBlockingRelationships($idcookie);
if ($planlove) {
// hit the index
$q->select('a.username, p.plan, l.lover_id');
$q->from('Planlove l')->leftJoin('l.Lover a')->leftJoin('a.Plan p');
$q->where('l.lovee_id = ?', "{$thesearchnum}");
$q->andWhereNotIn('l.lover_id', $ids_to_hide);
} else {
// do a slow query
$q->select('a.username, p.plan');
$q->from('Accounts a')->leftJoin('a.Plan p');
$q->where('p.edit_text LIKE ?', "%{$mysearch}%");
$q->andWhereNotIn('a.userid', $ids_to_hide);
}
if (!$idcookie) {
$q->addWhere('a.webview=1');
示例5: Form
//if time is out of acceptable period, set to 12
//give form to set how many hours back to look
$timeform = new Form('planwatchtimeform', true);
$timeform->action = 'planwatch.php';
$timeform->method = 'POST';
$thispage->append($timeform);
$item = new TextInput('mytime', $mytime);
$item->title = 'Plans updated in the past:';
$item->description = 'hours';
$item->cols = 2;
$timeform->append($item);
$item = new SubmitInput('See Plans');
$timeform->append($item);
$q = Doctrine_Query::create()->select("userid,username,DATE_FORMAT(changed,\n'%l:%i %p, %a %M %D ') as updated")->from("Accounts a")->where("changed > DATE_SUB(NOW(), INTERVAL ? HOUR)", $mytime)->orderBy("changed desc");
if (User::logged_in()) {
$q->andWhereNotIn("userid", Block::allUserIdsWithBlockingRelationships(User::id()));
} else {
$q->andWhere('webview = 1');
}
$results = $q->fetchArray();
//do the query with specifying date format to be returned
$newplanslist = new WidgetList('new_plan_list', true);
$thispage->append($newplanslist);
//display the results of the query
foreach ($results as $new_plans) {
$entry = new WidgetGroup('newplan', false);
$plan = new PlanLink($new_plans["username"]);
$time = new RegularText($new_plans["updated"], 'Date Created');
$entry->append($plan);
$entry->append($time);
$newplanslist->append($entry);