本文整理汇总了PHP中entity_selector::set_num方法的典型用法代码示例。如果您正苦于以下问题:PHP entity_selector::set_num方法的具体用法?PHP entity_selector::set_num怎么用?PHP entity_selector::set_num使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity_selector
的用法示例。
在下文中一共展示了entity_selector::set_num方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addslashes
function _produce_borrowing_nav()
{
$ret = '';
$nes = new entity_selector();
$nes->add_type(id_of('type'));
$nes->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_cannot_edit_type'));
$nes->add_relation('`entity`.`id` = "' . addslashes($this->admin_page->type_id) . '"');
$nes->set_num(1);
$nes->limit_tables();
$nes->limit_fields();
$ns = $nes->run_one();
$show_edit = reason_user_has_privs($this->admin_page->user_id, 'edit') && !$this->admin_page->is_second_level() && empty($ns) ? true : false;
/* $type = new entity($this->admin_page->type_id);
$name = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
if(function_exists('mb_strtolower'))
$name = mb_strtolower($name);
else
$name = strtolower($name); */
$ret .= '<div class="borrowNav">' . "\n";
$ret .= '<ul>';
if ($show_edit) {
$ret .= '<li><a href="' . $this->admin_page->get_owned_list_link($this->admin_page->type_id) . '"><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/bullet_edit.png" alt="" /> Add & edit</a></li>';
}
$ret .= '<li class="current"><strong><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/car.png" alt="" /> Borrow</strong></li>';
$ret .= '</ul>' . "\n";
$ret .= '</div>' . "\n";
// if(reason_user_has_privs($this->admin_page->user_id,'edit'))
return $ret;
}
示例2: _link_in_db
protected function _link_in_db()
{
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('admin_link'));
$es->add_relation('`url` = "?cur_module=AdminTools"');
$es->set_num(1);
$results = $es->run_one();
return !empty($results);
}
示例3: get_loki_1_entity
/**
* @return object loki 1 entity if it exists
*/
protected function get_loki_1_entity()
{
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('html_editor_type'));
$es->add_relation('entity.name = "Loki 1"');
$es->set_num(1);
$result = $es->run_one();
return !empty($result) ? reset($result) : FALSE;
}
示例4:
function get_last_modified_item_selector()
{
$es = new entity_selector($this->site_id());
$es->add_type($this->type());
$es->limit_tables();
$es->limit_fields('last_modified');
$es->set_num(1);
$es->set_order('last_modified DESC');
return $es;
}
示例5: array
function do_updates($mode, $reason_user_id)
{
if ($mode != 'run' && $mode != 'test') {
trigger_error('$mode most be either "run" or "test"');
return;
}
$messages = array();
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('view_type'));
$es->add_relation('url = "sections_and_issues.php"');
$es->set_num(1);
$view_types = $es->run_one();
if (empty($view_types)) {
if ('test' == $mode) {
echo '<p>Would have added the view type sections_and_issues.php and the Sections and Issues view</p>' . "\n";
return;
} else {
$view_type_id = reason_create_entity(id_of('master_admin'), id_of('view_type'), $reason_user_id, 'News Sections and Issues', array('url' => 'sections_and_issues.php'));
$view_type = new entity($view_type_id);
echo '<p>Added the view type sections_and_issues.php</p>' . "\n";
}
} else {
echo '<p>sections_and_issues.php view type already added</p>' . "\n";
$view_type = current($view_types);
}
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('view'));
$es->add_left_relationship($view_type->id(), relationship_id_of('view_to_view_type'));
$es->set_num(1);
$views = $es->run_one();
if (empty($views)) {
if ('test' == $mode) {
echo '<p>Would have added the Sections and Issues view</p>' . "\n";
} else {
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('field'));
$es->add_relation('entity.name = "status"');
$es->set_num(1);
$fields = $es->run_one();
$view_id = reason_create_entity(id_of('master_admin'), id_of('view'), $reason_user_id, 'News Sections and Issues', array('display_name' => 'Sections and Issues'));
create_relationship($view_id, $view_type->id(), relationship_id_of('view_to_view_type'));
create_relationship($view_id, id_of('news'), relationship_id_of('view_to_type'));
if (!empty($fields)) {
$field = current($fields);
create_relationship($view_id, $field->id(), relationship_id_of('view_columns'));
create_relationship($view_id, $field->id(), relationship_id_of('view_searchable_fields'));
}
echo '<p>Added sections and issue view</p>';
}
} else {
echo '<p>sections and issues view already added.</p>' . "\n";
}
}
示例6: init
function init($args = array())
{
$es = new entity_selector($this->parent->site_id);
$es->description = 'Selecting blog/publications for this page';
$es->add_type(id_of('publication_type'));
$es->add_right_relationship($this->parent->cur_page->id(), relationship_id_of('page_to_publication'));
$es->set_num(1);
$blogs = $es->run_one();
if (!empty($blogs)) {
$this->blog = current($blogs);
}
}
示例7: entered
function run_error_checks()
{
parent::run_error_checks();
$es = new entity_selector();
$es->add_relation('audience_integration.directory_service_value = "' . reason_sql_string_escape($this->get_value('directory_service_value')) . '"');
$es->add_relation('entity.id != ' . $this->get_value('id'));
$es->set_num(1);
$conflicts = $es->run_one(id_of('audience_type'));
if (!empty($conflicts)) {
$this->set_error('directory_service_value', 'The Directory Service Value you entered ("' . $this->get_value('directory_service_value') . '") is already in use. Each audience must have a unique directory service value.');
}
}
示例8:
/**
* Check if the current site has the registration slot type.
*/
function site_has_slot_type()
{
if (!isset($this->_site_has_slot_type)) {
$es = new entity_selector();
$es->add_type(id_of('type'));
$es->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_to_type'));
$es->add_relation('entity.id = "' . id_of('registration_slot_type') . '"');
$es->set_num(1);
$result = $es->run_one();
$this->_site_has_slot_type = !empty($result);
}
return $this->_site_has_slot_type;
}
示例9: _dynamic_site_id_option_exists
protected function _dynamic_site_id_option_exists()
{
$es = new entity_selector(id_of('master_admin'));
$es->add_type(id_of('admin_link'));
$es->set_num(1);
$result = $es->run_one();
if ($result) {
$ret = reset($result);
$values = $ret->get_values();
return array_key_exists('add_dynamic_site_id', $values);
}
return false;
}
示例10:
/**
* Determine if a site has access to the image type
* @param integer $site_id site to test
* @return boolean
*/
function site_can_manage_images($site_id)
{
$es = new entity_selector();
$es->add_type(id_of('type'));
$es->add_right_relationship($site_id, relationship_id_of('site_to_type'));
$es->add_relation('entity.unique_name = "image"');
$es->set_num(1);
$types = $es->run_one();
if (empty($types)) {
return false;
} else {
return true;
}
}
示例11: reset
function get_form()
{
if (!isset($this->_form)) {
$this->_form = false;
// Get the form entity attached to the current page
$es = new entity_selector();
$es->add_type(id_of('form'));
$es->add_right_relationship($this->cur_page->id(), relationship_id_of('page_to_form'));
$es->set_num(1);
$result = $es->run_one();
if ($result) {
$this->_form = reset($result);
}
}
return $this->_form;
}
示例12: array
function get_feed_relationship_url()
{
static $cache = array();
if (!array_key_exists($this->parent->cur_page->id(), $cache)) {
$es = new entity_selector($this->parent->site_id);
$es->add_type(id_of('external_url'));
$es->add_right_relationship($this->parent->cur_page->id(), relationship_id_of('page_to_feed_url'));
$es->set_num(1);
$urls = $es->run_one();
if (!empty($urls)) {
$url = current($urls);
$cache[$this->parent->cur_page->id()] = $url->get_value('url');
} else {
$cache[$this->parent->cur_page->id()] = '';
}
}
return $cache[$this->parent->cur_page->id()];
}
示例13: init
function init($args = array())
{
$es = new entity_selector($this->site_id);
$es->description = 'Selecting publications for this page';
$es->add_type(id_of('publication_type'));
$es->add_right_relationship($this->page_id, relationship_id_of('page_to_publication'));
$es->set_num(1);
$publications = $es->run_one();
if (!empty($publications)) {
$this->publication = current($publications);
if ($this->publication->get_value('has_sections') == 'yes') {
$es = new entity_selector($this->site_id);
$es->description = 'Selecting news sections for this publication';
$es->add_type(id_of('news_section_type'));
$es->add_left_relationship($this->publication->id(), relationship_id_of('news_section_to_publication'));
$es->set_order('sortable.sort_order ASC');
$this->sections = $es->run_one();
}
}
if (!empty($this->sections) && !empty($this->publication) && $this->publication->get_value('has_issues')) {
if (!empty($this->request['issue_id'])) {
$iss = new entity($this->request['issue_id']);
if ($iss->get_values() && $iss->get_value('type') == id_of('issue_type')) {
$this->issue = $iss;
}
} else {
$es = new entity_selector($this->site_id);
$es->description = 'Selecting issues for this publication';
$es->add_type(id_of('issue_type'));
$es->limit_tables(array('dated', 'show_hide'));
$es->limit_fields('dated.datetime');
$es->set_order('dated.datetime DESC');
$es->add_relation('show_hide.show_hide = "show"');
$es->add_left_relationship($this->publication->id(), relationship_id_of('issue_to_publication'));
$es->set_num(1);
$issues = $es->run_one();
if (!empty($issues)) {
$this->issue = current($issues);
}
}
}
}
示例14: reason_iframe_get_media_file
function reason_iframe_get_media_file()
{
if (!empty($_REQUEST['media_file_id'])) {
$id = (int) $_REQUEST['media_file_id'];
if ($id) {
if ($work = reason_iframe_get_media_work()) {
$es = new entity_selector();
$es->add_type(id_of('av_file'));
$es->add_right_relationship($work->id(), relationship_id_of('av_to_av_file'));
$es->add_relation('`entity`.`id` = "' . addslashes($id) . '"');
$es->set_num(1);
$results = $es->run_one();
if (!empty($results)) {
return current($results);
}
}
}
}
return false;
}
示例15: init
function init($args = array())
{
$show = true;
if ($this->params['hide_on_item'] && !empty($this->request['story_id'])) {
$show = false;
} elseif ($this->params['hide_on_archive_pages'] && !empty($this->request['page']) && $this->request['page'] > 1) {
$show = false;
}
if ($show) {
$es = new entity_selector($this->site_id);
$es->description = 'Selecting publications for this page';
$es->add_type(id_of('publication_type'));
$es->add_right_relationship($this->page_id, relationship_id_of('page_to_publication'));
$es->set_num(1);
$publications = $es->run_one();
if (!empty($publications)) {
$this->publication = current($publications);
}
}
}