function get_links()
 {
     $links = parent::get_links();
     $es = new entity_selector($this->admin_page->site_id);
     $es->add_type(id_of('event_type'));
     $es->set_order('dated.datetime DESC');
     $values = $es->run_one();
     //should adjust so that can't rearrange slots for events that have only one or no registration slots.
     //also, probably not for past events either.
     if ($values) {
         foreach ($values as $event_id => $event) {
             $es2 = new entity_selector($this->admin_page->site_id);
             $es2->add_type(id_of('registration_slot_type'));
             $es2->add_right_relationship($event_id, relationship_id_of('event_type_to_registration_slot_type'));
             $numSlots = $es2->get_one_count();
             if ($numSlots > 1) {
                 $date = $event->get_value('datetime');
                 $name = 'Sort slots for ' . $event->get_value('name') . ' - ' . prettify_mysql_datetime($date);
                 $link = $this->admin_page->make_link(array('event_id' => $event->id(), 'default_sort' => false), true);
                 $links[$name] = $link;
             }
         }
         $this->links = $links;
         return $this->links;
     }
 }
 function image_may_be_shown($id)
 {
     if ($this->params['alternate_source_page_id']) {
         $page_id = $this->params['alternate_source_page_id'];
         if (!($site_id = get_owner_site_id($page_id))) {
             $site_id = $this->site_id;
         }
     } else {
         $page_id = $this->cur_page->id();
         $site_id = $this->site_id;
     }
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->set_env('site', $site_id);
     $es->add_right_relationship($page_id, relationship_id_of('minisite_page_to_image'));
     $es->add_relation('entity.id = ' . addslashes($id));
     $result = $es->run_one();
     //echo 'given id='.$id;
     if (!empty($result)) {
         //echo 'returning true';
         return true;
     } else {
         //echo 'returning false';
         return false;
     }
 }
 /**
  * Determines whether or not the current user has access to the specified media work.  If no username is provided, this function defaults to the currently-loggin-in username.
  *
  * @param string $username
  * @return boolean user has access
  */
 public function user_has_access_to_media($username = '')
 {
     // First, get the restricted group--if one exists
     $es = new entity_selector();
     $es->add_type(id_of('group_type'));
     $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_restricted_to_group'));
     $group = current($es->run_one());
     if (!empty($group)) {
         $gh = new group_helper();
         $gh->set_group_by_id($group->id());
         if ($gh->requires_login()) {
             if (!$username) {
                 $username = reason_check_authentication();
             }
             if ($username) {
                 if (!$gh->is_username_member_of_group($username)) {
                     return false;
                 }
             } else {
                 return false;
             }
         }
     }
     return true;
     // Return true if the user has access to view media work
 }
 /**
  * Make sure that the model is configured with a valid URL.
  *
  * @return string json
  */
 function build()
 {
     if ($site_id = $this->config('site_id')) {
         $s = get_microtime();
         $es = new entity_selector();
         $es->add_type(id_of('social_account_type'));
         $es->add_right_relationship($site_id, relationship_id_of('site_to_social_account'));
         $es->add_rel_sort_field($site_id, relationship_id_of('site_to_social_account'));
         $es->set_order('rel_sort_order ASC');
         $es->limit_tables();
         $es->limit_fields();
         if ($results = $es->run_one()) {
             $result_keys = array_keys($results);
             $sih = reason_get_social_integration_helper();
             foreach ($result_keys as $id) {
                 // get the integrator if it supports the SocialAccountProfileLinks interface
                 if ($integrator = $sih->get_social_account_integrator($id, 'SocialAccountProfileLinks')) {
                     $profile_links[$id]['icon'] = $integrator->get_profile_link_icon($id);
                     $profile_links[$id]['text'] = $integrator->get_profile_link_text($id);
                     $profile_links[$id]['href'] = $integrator->get_profile_link_href($id);
                 }
             }
             if (!empty($profile_links)) {
                 return $profile_links;
             }
         }
         return false;
     } else {
         trigger_error('The ReasonSocialProfileLinksModel must be provided with the configuration parameter site_id.', FATAL);
     }
 }
Esempio n. 5
0
 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 &amp; 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;
 }
function get_minisite_template($theme_id)
{
    $template = false;
    $es = new entity_selector();
    $es->add_type(id_of('minisite_template'));
    $es->add_right_relationship($theme_id, relationship_id_of('theme_to_minisite_template'));
    $tmp = $es->run_one();
    return current($tmp);
}
Esempio n. 7
0
 function load_by_type($type_id, $id, $user_id)
 {
     $this->_id = $id;
     $this->_original = new entity($this->_id);
     // load all fields used by this type
     $q = 'DESC entity';
     $r = db_query($q, 'Unable to get entity description');
     while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
         list($type, $args) = $this->plasmature_type_from_db_type($row['Field'], $row['Type']);
         $this->add_element($row['Field'], $type, $args);
     }
     // get tables associated with this type
     $es = new entity_selector();
     $es->description = 'disco reason: load_by_type: tables to type';
     $es->add_type(id_of('content_table'));
     $es->add_right_relationship($type_id, relationship_id_of('type_to_table'));
     $tables = $es->run_one();
     unset($es);
     // make an element for each field the type has
     foreach ($tables as $tid => $table) {
         // grab the type's entity tables and fields
         $es = new entity_selector();
         $es->description = 'disco reason 2: load_by_type: fields associated with table ' . $table->get_value('name');
         $es->add_type(id_of('field'));
         $es->add_left_relationship($tid, relationship_id_of('field_to_entity_table'));
         $fields = $es->run_one('', 'Live', 'field es');
         unset($es);
         foreach ($fields as $fid => $field) {
             $args = array();
             $type = '';
             // set the plasmature type if specified by the field, otherwise look up the default for the database type
             list($type, $args) = $this->plasmature_type_from_db_type($field->get_value('name'), $field->get_value('db_type'));
             if ($field->get_value('plasmature_type')) {
                 $type = $field->get_value('plasmature_type');
             }
             // hook for plasmature arguments here
             $this->add_element($field->get_value('name'), $type, $args, $field->get_value('db_type'));
         }
     }
     // load values
     $elements = $this->_original->get_values();
     foreach ($elements as $key => $val) {
         if (isset($val)) {
             $this->set_value($key, $val);
         }
     }
     $this->init();
     $this->change_element_type('type', 'hidden');
     $this->set_value('type', $type_id);
     $this->change_element_type('last_edited_by', 'hidden');
     $this->set_value('last_edited_by', $user_id);
     if (!reason_user_has_privs($user_id, 'edit_unique_names')) {
         $this->change_element_type('unique_name', 'hidden');
     } elseif ($this->get_value('unique_name')) {
         $this->change_element_type('unique_name', 'solidText');
     }
 }
Esempio n. 8
0
 /**
  * Standard Module init function
  *
  * Sets up page variables and runs the entity selctor that grabs the users
  * 
  * @return void
  */
 function init()
 {
     parent::init();
     $this->site = new entity($this->admin_page->site_id);
     $this->admin_page->title = 'Users with administrative access to ' . $this->site->get_value('name');
     $es = new entity_selector();
     $es->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_to_user'));
     $this->users = $es->run_one(id_of('user'));
 }
 function get_images_in_new_order($page_id)
 {
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->add_right_relationship($page_id, relationship_id_of('minisite_page_to_image'));
     $es->add_rel_sort_field($page_id, relationship_id_of('minisite_page_to_image'), 'rel_sort_order');
     $es->add_field('relationship', 'id', 'rel_id');
     $es->set_order('rel_sort_order ASC, dated.datetime ASC, meta.description ASC, entity.id ASC');
     return $es->run_one();
 }
Esempio n. 10
0
 function get_av_files($item, $num = 0)
 {
     $avf = new entity_selector();
     $avf->add_type(id_of('av_file'));
     $avf->add_right_relationship($item->id(), relationship_id_of('av_to_av_file'));
     $avf->set_order('av.media_format ASC, av.av_part_number ASC');
     if ($num) {
         $avf->set_num($num);
     }
     return $avf->run_one();
 }
Esempio n. 11
0
 function run()
 {
     $site_id = $this->site_id;
     $es = new entity_selector($site_id);
     $es->add_type(id_of('google_map_type'));
     $es->add_right_relationship($this->cur_page->id(), relationship_id_of('page_to_google_map'));
     $es->add_rel_sort_field($this->cur_page->id(), relationship_id_of('page_to_google_map'));
     $es->set_order('rel_sort_order');
     $gmaps = $es->run_one();
     draw_google_map($gmaps);
 }
 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);
     }
 }
Esempio n. 13
0
 /**
  * Initialize the module
  * grabs all the blurbs associated with the current site
  * @param $args array
  */
 function init($args = array())
 {
     parent::init($args);
     $master_admin_id = id_of('master_admin');
     $es = new entity_selector($master_admin_id);
     $es->limit_tables();
     $es->limit_fields();
     $es->add_type(id_of('text_blurb'));
     $es->add_right_relationship($this->site_id, relationship_id_of('site_to_announcement_blurb'));
     $es->set_env('site', $master_admin_id);
     $this->blurbs = $es->run_one();
 }
Esempio n. 14
0
 function setup_associated_items()
 {
     // populate associated entity selector from scratch
     $ass_es = new entity_selector();
     $ass_es->add_type($this->type_id);
     if ($this->rel_direction == 'a_to_b') {
         $ass_es->add_right_relationship($this->admin_page->id, $this->admin_page->rel_id);
     } else {
         $ass_es->add_left_relationship($this->admin_page->id, $this->admin_page->rel_id);
     }
     $ass_es->add_right_relationship_field('owns', 'entity', 'id', 'site_owner_id');
     if ($this->rel_direction == 'a_to_b' && $this->check_is_rel_sortable()) {
         $this->columns['rel_sort_order'] = true;
         $ass_es->add_field('relationship', 'id', 'rel_id');
         $ass_es->add_rel_sort_field($this->admin_page->id);
         $ass_es->set_order('relationship.rel_sort_order ASC');
         if ($this->_cur_user_has_edit_privs() && !$this->get_relationship_lock_state()) {
             $this->alter_order_enable = true;
         }
     } else {
         $ass_es->add_field('relationship', 'site', 'rel_site_id');
     }
     if ($this->assoc_viewer_order_by($ass_es)) {
         $this->alter_order_enable = false;
     }
     $this->ass_vals = $ass_es->run_one();
     // check sharing on associated entities
     foreach ($this->ass_vals as $k => $val) {
         // setup sharing value
         if ($this->site_id == $val->get_value('site_owner_id')) {
             $this->ass_vals[$k]->set_value('sharing', 'owns');
         } else {
             $this->ass_vals[$k]->set_value('sharing', $this->check_borrow_status($k));
         }
     }
     // this verifies and updates the associated items rel_sort_order if this is an a to b relationship
     if ($this->rel_direction == 'a_to_b' && $this->check_is_rel_sortable()) {
         if (count($this->ass_vals) == 1 && isset($this->columns['rel_sort_order'])) {
             unset($this->columns['rel_sort_order']);
         }
         if ($ass_es->orderby == 'relationship.rel_sort_order ASC') {
             $rel_update_array = $this->validate_rel_sort_order($this->ass_vals, true);
         } else {
             $rel_update_array = $this->validate_rel_sort_order($this->ass_vals);
         }
         if (count($rel_update_array) > 0) {
             foreach ($rel_update_array as $k => $v) {
                 update_relationship($k, array('rel_sort_order' => $v));
             }
         }
     }
 }
 /**
  * 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;
 }
Esempio n. 16
0
 /**
  * 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;
     }
 }
Esempio n. 17
0
/**
 * Root finder:
 * Takes a site id and returns the id of the root page. 
 * @param integer $site_id
 * @return mixed page id integer if found; NULL if not found
 */
function root_finder( $site_id )
{
    $es = new entity_selector( );
    $es->add_type( id_of( 'minisite_page') );
    $es->add_relation( 'entity.state = "Live"' );
    $es->add_right_relationship( $site_id, get_owns_relationship_id(id_of('minisite_page')) );
    $results = $es->run_one();
    foreach( $results as $page )
    {
        $page_id = $page->get_value( 'id' );
        if( is_site_root( $page_id ) )
            return $page_id;
    }
}
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Download Links for Media Work';
     $this->media_work = new entity($this->admin_page->id);
     if ($this->media_work->get_value('integration_library') == 'kaltura') {
         $this->kaltura_shim = new KalturaShim();
         $this->user = new entity($this->admin_page->user_id);
         // Grab the associated media files
         $es = new entity_selector();
         $es->add_type(id_of('av_file'));
         $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_av_file'));
         $this->media_files = $es->run_one();
     }
 }
Esempio n. 19
0
 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;
 }
 function init()
 {
     parent::init();
     $this->admin_page->title = 'Select Thumbnail for Media Work';
     $this->media_work = new entity($this->admin_page->id);
     $this->user = new entity($this->admin_page->user_id);
     // Grab the initial associated image, if it exists
     $es = new entity_selector();
     $es->add_type(id_of('image'));
     $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_primary_image'));
     $this->cur_image = current($es->run_one());
     $this->admin_page->head_items->add_javascript(JQUERY_URL, true);
     $this->admin_page->head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'media_image_picker_zencoder.js');
     // fd-slider is a polyfill for the range plasmature type
     $this->admin_page->head_items->add_javascript(REASON_PACKAGE_HTTP_BASE_PATH . 'fd-slider/js/fd-slider.js');
     $this->admin_page->head_items->add_stylesheet(REASON_PACKAGE_HTTP_BASE_PATH . 'fd-slider/css/fd-slider.css');
     $this->shim = MediaWorkFactory::shim($this->media_work);
 }
 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()];
 }
Esempio n. 22
0
 public function get_image()
 {
     if (!isset($this->_image)) {
         $es = new entity_selector();
         $es->add_type(id_of('image'));
         $es->add_right_relationship($this->_event->id(), relationship_id_of('event_to_image'));
         $es->add_rel_sort_field($this->_event->id(), relationship_id_of('event_to_image'));
         $es->set_order('rel_sort_order ASC');
         $es->set_num(1);
         $images = $es->run_one();
         if (!empty($images)) {
             $this->_image = current($images);
         } else {
             $this->_image = false;
         }
     }
     return $this->_image;
 }
Esempio n. 23
0
 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);
             }
         }
     }
 }
Esempio n. 24
0
 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);
         }
     }
 }
Esempio n. 25
0
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;
}
Esempio n. 26
0
 function init()
 {
     $this->head_items->add_stylesheet(REASON_ADMIN_CSS_DIRECTORY . 'archive.css');
     $this->current = new entity($this->admin_page->id);
     $this->_current_user = new entity($this->admin_page->user_id);
     $this->admin_page->title = 'History of "' . $this->current->get_value('name') . '"';
     $this->ignore_fields = array('id', 'last_edited_by', 'last_modified', 'creation_date', 'type', 'created_by', 'new', 'state');
     // get archive relationship id
     $this->rel_id = reason_get_archive_relationship_id($this->admin_page->type_id);
     $es = new entity_selector();
     $es->add_type($this->admin_page->type_id);
     $es->add_right_relationship($this->admin_page->id, $this->rel_id);
     $es->set_order('last_modified DESC, entity.id DESC');
     $archived = $es->run_one(false, 'Archived');
     $this->_locks[$this->current->id()] = array();
     // No problem replacing current entity with itself!
     foreach ($archived as $archive_id => $archive_entity) {
         $this->_locks[$archive_id] = $this->_get_archive_lock_info($archive_entity);
     }
     $history_top = array($this->current->id() => $this->current);
     $this->history = $history_top + $archived;
 }
Esempio n. 27
0
 /**
  * Get the groups that apply to a given page
  * @param integer $page_id
  * @return array of group objects
  */
 function get_groups($page_id)
 {
     if (!isset($this->_pages_to_groups[$page_id])) {
         $alrel_id = relationship_id_of('page_to_access_group');
         if (!$alrel_id) {
             trigger_error('page_to_access_group needs to be added. Please upgrade your database at ' . REASON_HTTP_BASE_PATH . 'scripts/upgrade/4.0b6_to_4.0b7/');
             return array();
         }
         $chain = $this->_page_tree->get_id_chain($page_id);
         if (empty($chain)) {
             trigger_error('Page ' . $page_id . 'does not appear to be in site.');
             $this->_pages_to_groups[$page_id] = array();
         } else {
             $es = new entity_selector();
             $es->add_type(id_of('group_type'));
             $es->limit_tables();
             $es->limit_fields();
             $es->add_right_relationship($chain, $alrel_id);
             $es->set_num(count($chain));
             $this->_pages_to_groups[$page_id] = $es->run_one();
         }
     }
     return $this->_pages_to_groups[$page_id];
 }
 /**
  * Generates and returns the html markup used to represent an audio media work.
  *
  * @access private
  * @return string embed markup
  */
 private function _get_audio_embed_markup()
 {
     $markup = '<audio id="' . $this->media_work->id() . '" preload="metadata" ';
     if ($this->show_controls) {
         $markup .= 'controls="controls" ';
     }
     if ($this->autostart) {
         $markup .= 'autoplay="autoplay" ';
     }
     $markup .= '>';
     $es = new entity_selector();
     $es->add_type(id_of('av_file'));
     $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_av_file'));
     $es->set_order('av.mime_type ASC');
     // 'mpeg' comes before 'ogg'
     $this->media_files = $es->run_one();
     $mp3 = false;
     foreach ($this->media_files as $file) {
         $markup .= '<source src="' . $this->_match_protocol($file->get_value('url')) . '" type="' . $file->get_value('mime_type') . '" />' . "\n";
         if ($file->get_value('mime_type') == 'audio/mpeg') {
             $mp3 = $file;
         }
     }
     // Fall back to flash player
     if ($mp3) {
         $avd = new reasonAVDisplay();
         $avd_autoplay = $this->autostart ? 'true' : 'false';
         $avd->set_parameter('flv', 'autostart', $avd_autoplay);
         if (!$this->show_controls) {
             $avd->set_parameter('flv', 'controlbar', '0');
         }
         $mp3->set_value('url', $this->_match_protocol($mp3->get_value('url')));
         $avd_markup = $avd->get_embedding_markup_For_flash_video($mp3);
         $markup .= $avd_markup;
         // return $avd_markup;  // uncomment this if testing the flash player
     }
     $markup .= '</audio>' . "\n";
     return $markup;
 }
Esempio n. 29
0
 function get_views($type_id)
 {
     $ds = new entity_selector();
     $ds->add_type(id_of('view'));
     $ds->limit_tables('sortable');
     $ds->limit_fields();
     $ds->set_order('sortable.sort_order');
     $ds->add_right_relationship($type_id, relationship_id_of('type_to_default_view'));
     $default_views = $ds->run_one();
     $ssvs = new entity_selector();
     $ssvs->add_type(id_of('view'));
     $ds->limit_tables('sortable');
     $ds->limit_fields();
     $ssvs->add_left_relationship($type_id, relationship_id_of('view_to_type'));
     $ssvs->add_left_relationship($this->admin_page->site_id, relationship_id_of('view_to_site'));
     $ssvs->set_order('sortable.sort_order');
     $site_specific_views = $ssvs->run_one();
     $this->views = $site_specific_views;
     foreach ($default_views as $id => $view) {
         if (!array_key_exists($id, $site_specific_views)) {
             $this->views[$id] = $view;
         }
     }
     if (!empty($this->admin_page->request['lister']) && array_key_exists($this->admin_page->request['lister'], $this->views)) {
         $view = $this->views[$this->admin_page->request['lister']];
         if ($view->id() == $this->admin_page->request['lister']) {
             $viewer_type = $view->get_left_relationship('view_to_view_type');
         }
     } elseif (!empty($this->views)) {
         reset($this->views);
         $view = current($this->views);
         $viewer_type = $view->get_left_relationship('view_to_view_type');
     }
     if (!empty($viewer_type)) {
         reset($viewer_type);
         $this->viewer_entity = current($viewer_type);
     }
 }
Esempio n. 30
0
 function get_site_pages($entity)
 {
     $e = new entity_selector();
     $e->add_type(id_of('minisite_page'));
     $e->add_right_relationship($entity->id(), relationship_id_of('site_owns_minisite_page'));
     $results = $e->run_one();
     return $results;
 }