本文整理汇总了PHP中entity::get_values方法的典型用法代码示例。如果您正苦于以下问题:PHP entity::get_values方法的具体用法?PHP entity::get_values怎么用?PHP entity::get_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity
的用法示例。
在下文中一共展示了entity::get_values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init($args = array())
{
if(isset($this->params['num_per_page']))
$this->num_per_page = $this->params['num_per_page'];
// only load javascript and css for integrated items
if ( !empty($this->request[ $this->query_string_frag.'_id' ]) )
{
$media_work = new entity($this->request[ $this->query_string_frag.'_id' ]);
if ($media_work->get_values() && $media_work->get_value('type') == id_of('av'))
{
$head_items = $this->get_head_items();
$head_items->add_javascript(JQUERY_URL, true);
$this->displayer_chrome = MediaWorkFactory::displayer_chrome($media_work, 'av');
if ($this->displayer_chrome)
{
$this->displayer_chrome->set_module($this);
$this->displayer_chrome->set_head_items($head_items);
}
}
}
parent::init($args);
}
示例2: entity
function thor_build_display_values()
{
$form = new entity($this->form_id);
$form->get_values();
if ($form->get_value('type') != id_of('form'))
{
trigger_error('the thor viewer was passed an invalid id ('.$form_id.') - it must be passed the ID of a reason form entity');
}
else
{
$form_xml_obj = new XMLParser($form->get_value('thor_content'));
$form_xml_obj->Parse();
$display_values = array();
foreach ($form_xml_obj->document->tagChildren as $k=>$v)
{
$tagname = is_object($v) ? $v->tagName : '';
if (method_exists($this, '_build_display_'.$tagname))
{
$build_function = '_build_display_'.$tagname;
$display_values = array_merge($display_values, $this->$build_function($v));
}
}
}
foreach ($this->extra_fields as $field_name)
{
$display_values[$field_name]['label'] = prettify_string($field_name);
$display_values[$field_name]['type'] = 'text';
}
$this->_display_values = (isset($display_values)) ? $display_values : array();
}
示例3: entity
function set_audience_id($aud_id)
{
$aud = new entity($aud_id);
if ($aud->get_values()) {
$this->audiences[$aud_id] = $aud;
}
}
示例4: run
function run()
{
if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
echo '<p>Sorry; use of this module is restricted.</p>' . "\n";
return;
}
if (!empty($this->admin_page->request['entity_id_test'])) {
$id = $this->admin_page->request['entity_id_test'];
settype($id, 'integer');
}
if (empty($id)) {
$id = '';
}
echo '<form method="get" action="?"><label for="entity_id_test">Entity ID:</label> <input type="text" name="entity_id_test" id="entity_id_test" value="' . $id . '"/><input type="submit" value="submit" /><input type="hidden" name="cur_module" value="EntityInfo" /></form>';
if (!empty($id)) {
$entity = new entity($id);
if ($entity->get_values()) {
echo '<div class="EntityInfo">' . "\n";
$this->show_entity_header($entity);
$this->show_entity_data($entity);
$this->show_pages($entity);
$this->show_borrowing_sites($entity);
$this->show_entity_relationships($entity);
echo '</div>' . "\n";
} else {
echo '<p>The Reason ID ' . $id . ' does not belong to a real entity. It may have been deleted.</p>';
}
}
}
示例5: entity
function apply_order_and_limits(&$es)
{
$limit_tables = true;
if (isset($this->viewer_id) && !empty($this->viewer_id)) {
$viewer = new entity($this->viewer_id);
if ($viewer->get_values() && $viewer->get_value('type') == id_of('view')) {
$viewer_default_sort = $viewer->get_value('default_sort');
if (!empty($viewer_default_sort)) {
$limit_tables = false;
}
}
}
if (!empty($this->admin_page->request['order_by'])) {
$alias = isset($this->alias[$this->admin_page->request['order_by']]) ? $this->alias[$this->admin_page->request['order_by']] : '';
if ($alias) {
$table = $alias['table'] . '.' . $alias['field'];
$table_name = $alias['table_orig'];
} else {
$table = table_of($this->admin_page->request['order_by'], $this->type_id);
$table_name = substr($table, 0, strpos($table, '.' . $this->admin_page->request['order_by']));
}
if ($table) {
$es->set_order($table . ' ' . $this->admin_page->request['dir']);
if (!$this->check_filters() && $limit_tables) {
$es->limit_tables($table_name);
}
// only limit if filters are not being used
}
} elseif (!$this->check_filters() && $limit_tables) {
$es->limit_tables();
}
// only limit if filters are not being used
}
示例6: entity
function set_event($event)
{
if (!is_object($event)) {
$event_id = turn_into_int($event);
$event = new entity($event_id);
}
if ($event->get_values() && $event->get_value('type') == id_of('event_type')) {
$this->event = $event;
} else {
trigger_error('Entity passed to reasonEvent object that is not an event');
$this->event = NULL;
}
}
示例7: entity
function &get_form()
{
if (!isset($this->_form)) {
$form = new entity($this->admin_page->id);
if ($form->get_values() && $form->get_value('type') == id_of('form')) {
$owner = $form->get_owner();
if ($owner->id() == $this->admin_page->site_id) {
$this->_form = $form;
}
}
if (!isset($this->_form)) {
$this->_form = false;
}
}
return $this->_form;
}
示例8: 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);
}
}
}
}
示例9: entity
/**
* Move all the fields of one table into another table for a specific type
*
* This method is for denormalizing Reason tables. For example, a type may use a common table
* like meta, datetime, or chunk. For performance reasons, it can be desirable to collapse
* these tables into a single table just for that type. This method will do that.
*
* @param integer $type The ID of the type whose fields we are moving
* @param string $source_table The name of the table we are moving fields FROM
* @param string $destination_table The name of the table we are moving fields TO
* @param integer $user_id The Reason ID of the user who is doing this move
* @return boolean Success
*
* @todo Add limit to ensure fields are only created that don't already exist
*/
function reason_move_table_fields($type, $source_table, $destination_table, $user_id)
{
// Sanity checks
if(empty($type))
{
trigger_error('No type provided in reason_move_table_fields()');
return false;
}
if(empty($source_table))
{
trigger_error('No source table provided in reason_move_table_fields()');
return false;
}
if(!is_string($source_table))
{
trigger_error('Source table provided not a string in reason_move_table_fields()');
return false;
}
if(empty($destination_table))
{
trigger_error('No destination table provided in reason_move_table_fields()');
return false;
}
if(!is_string($destination_table))
{
trigger_error('Destination table provided not a string in reason_move_table_fields()');
return false;
}
if('entity' == $source_table || 'entity' == $destination_table)
{
trigger_error('reason_move_table_fields() cannot move fields into or out of the entity table.');
return false;
}
if(is_object($type))
{
$type_id = $type->id();
}
elseif(is_numeric($type))
{
$type_id = (integer) $type;
}
else
{
$type_id = id_of($type);
}
if(empty($type_id))
{
trigger_error('Invalid type specified in reason_move_table_fields().');
return false;
}
if(is_object($type))
$type_entity = $type;
else
$type_entity = new entity($type_id);
$type_vals = $type_entity->get_values();
if(empty($type_vals))
{
trigger_error('Type specified (id '.$type_id.') is not a Reason entity in reason_move_table_fields().');
return false;
}
if($type_entity->get_value('type') != id_of('type'))
{
trigger_error('Type specified (id '.$type_id.') is not a Type entity in reason_move_table_fields().');
return false;
}
if($type_entity->get_value('state') != 'Live')
{
trigger_error('Type specified (id '.$type_id.') is not a live entity in reason_move_table_fields().');
return false;
}
if(empty($user_id))
{
trigger_error('No user id specified in reason_move_table_fields().');
return false;
//.........这里部分代码省略.........
示例10: entity
function show_item_last_edited_by($field, $value)
{
if ($value) {
$user = new entity($value);
if ($user->get_values()) {
$name = $user->get_value('name');
} else {
$name = 'User ID ' . $value;
}
$new_value = $name . ' on ' . prettify_mysql_timestamp($this->_entity->get_value('last_modified'), 'M j, Y \\a\\t g:i a');
$this->show_item_default('Last Edited By', $new_value);
} else {
$new_value = prettify_mysql_timestamp($this->_entity->get_value('last_modified'), 'M j, Y \\a\\t g:i a');
$this->show_item_default('Last Edited On', $new_value);
}
}
示例11: entity
function show_persistent()
{
if(!empty($this->current_item_id) && $this->request['story_id'] == $this->current_item_id)
{
$item = new entity($this->current_item_id);
$item->get_values();
$persistent_markup_generator = $this->set_up_generator_of_type('persistent', $item);
}
else
{
$persistent_markup_generator = $this->set_up_generator_of_type('persistent');
}
echo $persistent_markup_generator->get_markup();
}
示例12: init
function init()
{
if (!$this->admin_page->id) {
return false;
}
//these next few lines check the entity to make sure it has everything it needs
$this->load_content_manager();
$this->check_entity_values();
$this->get_required_relationships();
if (!empty($this->req_rels)) {
$this->check_required_relationships();
}
/* the new finish stuff */
// new_entity stuff
// figure out if the entity is new and store that so we can change the data in the database but still know what's going on
$temp = new entity($this->admin_page->id, false);
if ($temp->get_value('new')) {
$this->new_entity = true;
} else {
$this->new_entity = false;
}
// when finishing an entity, we want to ensure that it is live and not new (unless it is a page)
if ($this->admin_page->type_id != id_of('minisite_page') && $temp->get_value('state') == 'Pending' && reason_user_has_privs($this->admin_page->user_id, 'publish')) {
$update_values['state'] = 'Live';
if (!empty($this->disco_item)) {
$this->disco_item->set_value('state', "Live");
}
}
if ($temp->get_value('new') != '0') {
$update_values['new'] = 0;
if (!empty($this->disco_item)) {
$this->disco_item->set_value('new_entity', 0);
}
}
if (!empty($update_values)) {
reason_update_entity($this->admin_page->id, $this->admin_page->user_id, $update_values, false);
// archive, yes?
}
$original = new entity($this->admin_page->id, false);
$original->get_values();
// get archive relationship id
$q = 'SELECT id FROM allowable_relationship WHERE name LIKE "%archive%" AND relationship_a = ' . $this->admin_page->type_id . ' AND relationship_b = ' . $this->admin_page->type_id;
$r = db_query($q, 'Unable to get archive relationship.');
$row = mysql_fetch_array($r, MYSQL_ASSOC);
$this->rel_id = $row['id'];
// get archives
$es = new entity_selector($this->admin_page->site_id);
$es->add_type($this->admin_page->type_id);
$es->add_right_relationship($this->admin_page->id, $this->rel_id);
$es->add_relation('last_modified = "' . $original->get_value('last_modified') . '"');
$es->set_num(1);
$similar_archived = $es->run_one('', 'Archived');
// if the entity has in fact been changed, actually create the relationship
if (empty($similar_archived)) {
$archived_id = duplicate_entity($original, false, true, array('state' => 'Archived'));
create_relationship($this->admin_page->id, $archived_id, $this->rel_id);
}
// DETERMINE WHERE TO GO
if (!empty($this->admin_page->request[CM_VAR_PREFIX . 'type_id'])) {
// this code block is intended to associate a new entity with the context entity upon finish - it once created backwards relationships IF we reached an
// entity with get_value('new') = 1 from the reverse associator. This needs fixin. We do so by running this section of code only in the case where
// the "old" module was the associator (the only module that allows the creation of new entities than need a relationship back to the a side entity
// whose context is relevant.
if ($this->new_entity && $this->admin_page->request[CM_VAR_PREFIX . 'cur_module'] == 'Associator') {
$rel_info = reason_get_allowable_relationship_info($this->admin_page->request[CM_VAR_PREFIX . 'rel_id']);
$entity_a = new entity($this->admin_page->request[CM_VAR_PREFIX . 'id']);
$entity_b = new entity($this->admin_page->request['id']);
// lets do a bit of additional sanity checking.
if ($rel_info['relationship_a'] == $entity_a->get_value('type') && $rel_info['relationship_b'] == $entity_b->get_value('type')) {
if ($rel_info['connections'] == 'one_to_many') {
$this->delete_existing_relationships();
}
create_relationship($entity_a->id(), $entity_b->id(), $rel_info['id']);
}
}
$old_vars = array();
foreach ($this->admin_page->request as $key => $val) {
if (substr($key, 0, strlen(CM_VAR_PREFIX)) == CM_VAR_PREFIX) {
$old_vars[substr($key, strlen(CM_VAR_PREFIX))] = $val;
$old_vars[$key] = '';
}
}
foreach ($this->admin_page->default_args as $arg) {
if (!isset($old_vars[$arg])) {
$old_vars[$arg] = '';
}
}
$link = $this->admin_page->make_link($old_vars);
} elseif (!empty($this->admin_page->request['next_entity'])) {
$link = $this->admin_page->make_link(array('cur_module' => 'Editor', 'id' => $this->admin_page->request['next_entity']));
} else {
$link = $this->admin_page->make_link(array('id' => '', 'site_id' => $this->admin_page->site_id, 'type_id' => $this->admin_page->type_id, 'cur_module' => 'Lister'));
}
// before redirecting, check to see if there are any custom finish actions associated with this type.
// the entity_type variable is declared earlier in the check_entity_values method.
//Run any custom finish actions specified in the content manager
if (!empty($this->disco_item)) {
$this->disco_item->run_custom_finish_actions($this->new_entity);
}
if ($this->entity_type->get_value('finish_actions')) {
//.........这里部分代码省略.........
示例13: sitebar
function sitebar()
{
echo '<div class="sites">';
if (!$this->id) {
$sites = $this->get_sites();
echo '<form action="?" name="siteSwitchSelect" class="jumpNavigation" method="get">' . "\n";
echo 'Site: <select name="site_id" class="jumpDestination siteMenu">' . "\n";
echo '<option value="">--</option>' . "\n";
foreach (array_keys($sites) as $site_id) {
echo '<option value="' . $site_id . '"';
if ($site_id == $this->site_id) {
echo ' selected="selected"';
}
echo '>' . strip_tags($sites[$site_id]->get_value('name')) . '</option>' . "\n";
}
$this->show['sites'] = false;
echo '</select>';
if (isset($_GET['user_id']) && !empty($_GET['user_id'])) {
$user_id = turn_into_int($_GET['user_id']);
if (!empty($user_id)) {
echo '<input type="hidden" name="user_id" value="' . $user_id . '" />';
}
}
echo '<input type="submit" class="jumpNavigationGo" value="go" />';
$cur_site = $sites[$this->site_id];
$cur_site_base_url = $cur_site->get_value('base_url');
$cur_site_unique_name = $cur_site->get_value('unique_name');
$user = new entity($this->user_id);
$target = $user->get_value('site_window_pref') == 'Popup Window' ? 'target="_blank" ' : '';
if (!empty($cur_site_base_url) && $cur_site_unique_name != 'master_admin') {
echo '<a href="http://' . REASON_HOST . $cur_site_base_url . '" ' . $target . 'class="publicSiteLink">Go to public site</a>';
}
echo '</form>';
} else {
$site = new entity($this->site_id);
if ($site->get_values()) {
echo 'Site: <strong>' . $site->get_value('name') . '</strong>' . "\n";
if ($this->type_id) {
$e = new entity($this->type_id);
echo '<strong> :: </strong>' . prettify_string($e->get_value('name'));
if ($this->id) {
$e = new entity($this->id);
echo '<strong> :: </strong>' . $e->get_value('name');
}
}
}
}
echo '</div>';
}
示例14: entity
/**
* Make sure the input from userland is sanitized
* @return void
*/
function validate_inputs()
{
if (!isset($this->calendar)) $this->calendar = new reasonCalendar;
$views = $this->calendar->get_views();
if(!empty($this->request['start_date']))
$this->request['start_date'] = prettify_mysql_datetime($this->request['start_date'], 'Y-m-d');
if(!empty($this->request['end_date']))
$this->request['end_date'] = prettify_mysql_datetime($this->request['end_date'], 'Y-m-d');
if(!empty($this->request['date']))
$this->request['date'] = prettify_mysql_datetime($this->request['date'], 'Y-m-d');
if(!empty($this->request['category']))
{
$e = new entity($this->request['category']);
if(!($e->get_values() && $e->get_value('type') == id_of('category_type')))
{
unset($this->request['category']);
}
}
if(!empty($this->request['audience']))
{
$e = new entity($this->request['audience']);
if(!($e->get_values() && $e->get_value('type') == id_of('audience_type')))
{
unset($this->request['audience']);
}
}
}
示例15: modify_head_items
/**
* Modify the head items of a Reason page
*
* This is the primary (and simplest) way for a theme customizer to affect the look of a site.
*
* @param object $head_items
* @return void
*/
public function modify_head_items($head_items)
{
$data = $this->get_customizaton_data();
if (!empty($data)) {
$css = '';
if (!empty($data->background_color)) {
$css .= 'body{background-color:#' . $data->background_color . ';}';
}
if (!empty($data->text_color)) {
$css .= 'body{color:#' . $data->text_color . ';}';
}
if (!empty($data->banner_font)) {
$css .= '#banner,.banner{font-family:"' . $data->banner_font . '";}';
}
if (!empty($data->banner_image_id)) {
$image = new entity($data->banner_image_id);
if ($image->get_values() && $image->get_value('type') == id_of('image')) {
$rsi = new reasonSizedImage();
$rsi->set_id($data->banner_image_id);
$rsi->set_width(1680);
$rsi->set_height(205);
$css .= '#banner,.banner{background-image:url("' . $rsi->get_url() . '");}';
} else {
trigger_error('Banner image ID in theme customizer not valid');
}
}
$head_items->add_head_item('style', array('type' => 'text/css'), $css);
}
}