本文整理汇总了PHP中Criteria::addOrderAscending方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addOrderAscending方法的具体用法?PHP Criteria::addOrderAscending怎么用?PHP Criteria::addOrderAscending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::addOrderAscending方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadListFromTable
public function loadListFromTable($listName)
{
$tableName = $listName;
// table must have columns: key, text and sort_index
// the row with option_id = null indicates the "please select" value
$peerName = $peerName = "DB_" . capitalizeFirstLetter(underscoreToLowerCase($tableName)) . "Peer";
$peer = new $peerName();
$c = new Criteria();
$c->add("key", null);
$pleaseSelectOption = $peer->selectOne($c);
$c = new Criteria();
$c->add("key", null, "!=");
$c->addOrderAscending("sort_index");
$c->addOrderAscending("text");
$options = $peer->select($c);
if ($pleaseSelectOption != null) {
$this->pleaseSelectValues["{$listName}"] = $pleaseSelectOption->getText();
} else {
// try SELECT_PLEASE_SELECT from the messages...
$text = MessageResolver::instance()->message("SELECT_PLEASE_SELECT");
if ($text != null) {
$this->pleaseSelectValues["{$listName}"] = $text;
}
}
$out = array();
foreach ($options as $option) {
$optionKey = $option->getKey();
$out["{$optionKey}"] = $option->getText();
}
$this->storage["{$listName}"] = $out;
}
示例2: build
public function build($runData)
{
$pl = $runData->getParameterList();
$site = $runData->getTemp("site");
$categoryName = $pl->getParameterValue("category", "MODULE", "AMODULE");
$details = $pl->getParameterValue("details", "MODULE", "AMODULE");
$preview = $pl->getParameterValue("preview", "MODULE", "AMODULE");
$order = $pl->getParameterValue("order", "MODULE", "AMODULE");
$limit = $pl->getParameterValue("limit", "MODULE", "AMODULE");
if ($categoryName !== null) {
$category = DB_CategoryPeer::instance()->selectByName($categoryName, $site->getSiteId());
if ($category == null) {
throw new ProcessException(_("The category can not be found."));
}
}
// now select pages according to the specified criteria
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
if ($category) {
$c->add("category_id", $category->getCategoryId());
}
switch ($order) {
case 'dateCreatedDesc':
$c->addOrderDescending('page_id');
break;
case 'dateCreatedAsc':
$c->addOrderAscending('page_id');
break;
case 'dateEditedDesc':
$c->addOrderDescending('date_last_edited');
break;
case 'dateEditedAsc':
$c->addOrderAscending('date_last_edited');
break;
case 'titleDesc':
$c->addOrderDescending("COALESCE(title, unix_name)");
break;
default:
$c->addOrderAscending("COALESCE(title, unix_name)");
}
if ($limit && is_numeric($limit) && $limit > 0) {
$c->setLimit($limit);
}
$pages = DB_PagePeer::instance()->select($c);
// by default cathegorize by first letter...
$runData->contextAdd("pages", $pages);
$runData->contextAdd("details", $details);
$runData->contextAdd("preview", $preview);
}
示例3: build
public function build($runData)
{
$pl = $runData->getParameterList();
$threadId = $pl->getParameterValue("threadId");
$site = $runData->getTemp("site");
$db = Database::connection();
$db->begin();
$thread = DB_ForumThreadPeer::instance()->selectByPrimaryKey($threadId);
if ($thread == null || $thread->getSiteId() !== $site->getSiteId()) {
throw new ProcessException(_("No thread found... Is it deleted?"), "no_thread");
}
$category = $thread->getForumCategory();
WDPermissionManager::instance()->hasForumPermission('moderate_forum', $runData->getUser(), $category);
$runData->contextAdd("thread", $thread);
$runData->contextAdd("category", $thread->getForumCategory());
// and select categories to move into too.
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
$c->addOrderDescending("visible");
$c->addOrderAscending("sort_index");
$groups = DB_ForumGroupPeer::instance()->select($c);
$res = array();
foreach ($groups as $g) {
$c = new Criteria();
$c->add("group_id", $g->getGroupId());
$c->addOrderAscending("sort_index");
$categories = DB_ForumCategoryPeer::instance()->select($c);
foreach ($categories as $cat) {
$res[] = array('group' => $g, 'category' => $cat);
}
}
$runData->contextAdd("categories", $res);
$db->commit();
}
示例4: build
public function build($runData)
{
$user = $runData->getUser();
$pl = $runData->getParameterList();
$pageId = $pl->getParameterValue("pageId");
$site = $runData->getTemp("site");
if (!$pageId || !is_numeric($pageId)) {
throw new ProcessException(_("The page can not be found or does not exist."), "no_page");
}
$page = DB_PagePeer::instance()->selectByPrimaryKey($pageId);
if ($page == null || $page->getSiteId() != $site->getSiteId()) {
throw new ProcessException(_("Error getting page information."), "no_page");
}
$category = $page->getCategory();
WDPermissionManager::instance()->hasPagePermission('edit', $user, $category, $page);
// get the tags now
$c = new Criteria();
$c->add("page_id", $pageId);
$c->addOrderAscending("tag");
$tags = DB_PageTagPeer::instance()->select($c);
$t2 = array();
foreach ($tags as $t) {
$t2[] = $t->getTag();
}
$t3 = implode(' ', $t2);
$runData->contextAdd("tags", $t3);
}
示例5: build
public function build($runData)
{
$pl = $runData->getParameterList();
$site = $runData->getTemp("site");
// get groups and categories
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
if (!$pl->getParameterValue("hidden")) {
$c->add("visible", true);
$runData->contextAdd("hidden", true);
}
$c->addOrderAscending("sort_index");
$groups = DB_ForumGroupPeer::instance()->select($c);
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
$c->addOrderAscending("sort_index");
$categories = DB_ForumCategoryPeer::instance()->select($c);
// now mangle the categories and put into array
// - in order to avoid several queries
$cats = array();
foreach ($categories as $category) {
$cats[$category->getGroupId()][] = $category;
}
$runData->contextAdd("groups", $groups);
$runData->contextAdd("catarray", $cats);
}
示例6: build
public function build($runData)
{
$userId = $runData->getUserId();
$pl = $runData->getParameterList();
$messageId = $pl->getParameterValue("message_id");
$message = DB_PrivateMessagePeer::instance()->selectByPrimaryKey($messageId);
if ($message->getFromUserId() != $userId) {
throw new ProcessException(_("Error selecting message."), "no_message");
}
$runData->contextAdd("message", $message);
// get next & previous message
$messageId = $message->getMessageId();
$c = new Criteria();
$c->add("from_user_id", $userId);
$c->add("message_id", $messageId, ">");
$c->add("flag", 1);
$c->addOrderAscending("message_id");
$newerMessage = DB_PrivateMessagePeer::instance()->selectOne($c);
$c = new Criteria();
$c->add("from_user_id", $userId);
$c->add("message_id", $messageId, "<");
$c->add("flag", 1);
$c->addOrderDescending("message_id");
$olderMessage = DB_PrivateMessagePeer::instance()->selectOne($c);
$runData->contextAdd("newerMessage", $newerMessage);
$runData->contextAdd("olderMessage", $olderMessage);
}
示例7: build
public function build($runData)
{
$site = $runData->getTemp("site");
$fsettings = $site->getForumSettings();
if (!$fsettings) {
throw new ProcessException(_("Forum not activated (yet)."));
}
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
$c->addOrderAscending("sort_index");
$groups = DB_ForumGroupPeer::instance()->select($c);
$catout = array();
$catout2 = array();
foreach ($groups as $group) {
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
$c->addOrderAscending("sort_index");
$c->add("group_id", $group->getGroupId());
$categories = DB_ForumCategoryPeer::instance()->select($c);
$catout[$group->getGroupId()] = $categories;
foreach ($categories as $cat) {
$catout2[] = $cat->getFieldValuesArray();
}
}
$defaultPermissions = $fsettings->getPermissions();
$runData->contextAdd("groups", $groups);
$runData->contextAdd("categories", $catout);
$runData->ajaxResponseAdd("categories", $catout2);
$runData->contextAdd("defaultPermissions", $defaultPermissions);
}
示例8: build
public function build($runData)
{
$site = $runData->getTemp("site");
$runData->contextAdd("site", $site);
// select templates
$templatesCategory = DB_CategoryPeer::instance()->selectByName("template", $site->getSiteId());
if ($templatesCategory == null) {
$runData->contextAdd("noTemplates", true);
return;
}
$c = new Criteria();
$c->add("category_id", $templatesCategory->getCategoryId());
$c->addOrderAscending("title");
$templates = DB_PagePeer::instance()->select($c);
$runData->contextAdd("templates", $templates);
// get all categories for the site
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
$c->addOrderAscending("replace(name, '_', '00000000')");
$categories = DB_CategoryPeer::instance()->select($c);
$runData->contextAdd("categories", $categories);
// also prepare categories to put into javascript...
$cats2 = array();
foreach ($categories as $category) {
$cats2[] = $category->getFieldValuesArray();
}
$runData->ajaxResponseAdd("categories", $cats2);
}
示例9: build
public function build($runData)
{
$pl = $runData->getParameterList();
$tag = $pl->getParameterValue("tag");
if ($tag === null) {
$runData->setModuleTemplate("Empty");
return;
}
$lang = $pl->getParameterValue("lang");
if ($lang && $lang !== "pl" && $lang !== "en") {
$lang = null;
}
// get sites
$title = $pl->getParameterValue("title");
$runData->contextAdd("title", $title);
$c = new Criteria();
$c->setExplicitFrom("site, site_tag");
$c->add("site_tag.tag", $tag);
$c->add("site.visible", true);
$c->add("site.private", false);
$c->add("site.deleted", false);
if ($lang) {
$c->add("site.language", $lang);
}
$c->add("site_tag.site_id", "site.site_id", "=", false);
$c->addOrderAscending('site.name');
$sites = DB_SitePeer::instance()->select($c);
// $q = "SELECT site.* FROM site, tag WHERE tag.tag = '".db_escape_string($tag")."'
$runData->contextAdd("tag", $tag);
$runData->contextAdd("sites", $sites);
$runData->contextAdd("sitesCount", count($sites));
}
示例10: build
public function build($runData)
{
$pl = $runData->getParameterList();
$site = $runData->getTemp("site");
$root = $pl->getParameterValue("root");
$showRoot = $pl->getParameterValue("showRoot");
if (!$root) {
$page = $runData->getTemp("page");
} else {
$page = DB_PagePeer::instance()->selectByName($site->getSiteId(), $root);
}
if (!$page) {
$runData->setModuleTemplate("Empty");
return;
}
$depth = $pl->getParameterValue("depth");
if (!$depth || !is_numeric($depth) || $depth < 1) {
$depth = 5;
}
$tree = array();
$c = new Criteria();
$c->add("parent_page_id", $page->getPageId());
$c->addOrderAscending("COALESCE(title, unix_name)");
$children = DB_PagePeer::instance()->select($c);
$descendants = array();
// select next level of children
$ch1 = $children;
$d = 0;
while ($ch1 != null && count($ch1) > 0 && (!$depth || $d < $depth)) {
$q = "SELECT * FROM page WHERE parent_page_id IN (";
$tch = array();
foreach ($ch1 as $ch) {
// check if already in the $tch
if (!array_key_exists($ch->getPageId(), $descendants)) {
$tch[] = $ch->getPageId();
$descendants[$ch->getParentPageId()][] = $ch;
} else {
$ch->setTemp('circular', true);
$descendants[$ch->getParentPageId()][] = $ch;
}
}
if (count($tch) > 0) {
$q .= implode(',', $tch);
$q .= ") ORDER BY COALESCE(title, unix_name)";
$c = new Criteria();
$c->setExplicitQuery($q);
$ch2 = DB_PagePeer::instance()->select($c);
$ch1 = $ch2;
} else {
$ch1 = null;
}
$d++;
}
$runData->contextAdd("root", $page);
$runData->contextAdd("children", $descendants);
if ($showRoot) {
$runData->contextAdd("showRoot", true);
}
}
示例11: build
public function build($runData)
{
$site = $runData->getTemp("site");
// get all categories
$c = new Criteria();
$c->add("site_id", $site->getSiteId());
$c->addOrderAscending("replace(name, '_', '00000000')");
$categories = DB_CategoryPeer::instance()->select($c);
$runData->contextAdd("categories", $categories);
}
示例12: build
public function build($runData)
{
$user = $runData->getUser();
// get all contacts
$c = new Criteria();
$c->add("contact.target_user_id", $user->getUserId());
$c->addJoin("user_id", "ozone_user.user_id");
$c->addOrderAscending("ozone_user.nick_name");
$contacts = DB_ContactPeer::instance()->select($c);
$runData->contextAdd("contacts", $contacts);
}
示例13: build
public function build($runData)
{
$c = new Criteria();
$c->add("site_id", $runData->getTemp("site")->getSiteId());
$c->addJoin("user_id", "ozone_user.user_id");
$c->addOrderAscending("ozone_user.nick_name");
$mems = DB_ModeratorPeer::instance()->select($c);
if (count($mems) > 0) {
$runData->contextAdd("moderators", $mems);
}
}
示例14: build
public function build($runData)
{
$pl = $runData->getParameterList();
$pageId = $pl->getParameterValue("pageId");
$c = new Criteria();
$c->add("page_id", $pageId);
$c->add("has_resized", true);
$c->addOrderAscending("filename");
$files = DB_FilePeer::instance()->select($c);
$runData->contextAdd("files", $files);
}
示例15: build
public function build($runData)
{
$pl = $runData->getParameterList();
$pageId = $pl->getParameterValue("pageId");
$page = DB_PagePeer::instance()->selectByPrimaryKey($pageId);
$c = new Criteria();
$c->add("page_id", $page->getPageId());
$c->addJoin("user_id", "ozone_user.user_id");
$c->addOrderAscending("ozone_user.nick_name");
$rates = DB_PageRateVotePeer::instance()->select($c);
$runData->contextAdd("rates", $rates);
}