コード例 #1
0
 function init($args = array())
 {
     $this->get_head_items()->add_javascript(REASON_HTTP_BASE_PATH . 'modules/kaltura_import/kaltura_import.js');
     $this->get_head_items()->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/kaltura_import/kaltura_import.css');
     force_secure_if_available();
     parent::init($args);
 }
コード例 #2
0
 function init($args = array())
 {
     parent::init($args);
     $this->es = new entity_selector();
     $this->es->description = 'Selecting children of the page';
     // find all the children of the parent page
     $this->es->add_type(id_of('minisite_page'));
     $this->es->add_left_relationship($this->get_parent_page_id(), relationship_id_of('minisite_page_parent'));
     if ($this->params['show_only_pages_in_nav']) {
         $this->es->add_relation('nav_display = "Yes"');
     }
     if (isset($this->params['show_external_links']) && !$this->params['show_external_links']) {
         $this->es->add_relation('(url = "" OR url IS NULL)');
     }
     if (!empty($this->params['exclude'])) {
         $this->es->add_relation('unique_name NOT IN (' . $this->_param_to_sql_set($this->params['exclude']) . ')');
     }
     if (!empty($this->params['limit_to'])) {
         $this->es->add_relation('unique_name IN (' . $this->_param_to_sql_set($this->params['limit_to']) . ')');
     }
     $this->es->set_order('sortable.sort_order ASC');
     $this->offspring = $this->es->run_one();
     if (isset($this->offspring[$this->get_parent_page_id()])) {
         unset($this->offspring[$this->get_parent_page_id()]);
     }
     if (!empty($this->params['provide_az_links'])) {
         foreach ($this->offspring as $child) {
             $page_name = $this->get_page_name($child);
             $letter = carl_strtoupper(substr($page_name, 0, 1), 'UTF-8');
             if (!in_array($letter, $this->az)) {
                 $this->az[$child->id()] = $letter;
             }
         }
     }
 }
コード例 #3
0
 function init($args = array())
 {
     parent::init($args);
     $site = new entity($this->site_id);
     if (!empty($this->params['sites'])) {
         $this->child_sites = array();
         foreach ($this->params['sites'] as $unique_name) {
             if ($id = id_of($unique_name)) {
                 $e = new entity($id);
                 if ($e->get_value('type') == id_of('site') && ($site->get_value('site_state') != 'Live' || $e->get_value('site_state') == 'Live')) {
                     $this->child_sites[$id] = $e;
                 }
             }
         }
     } else {
         $es = new entity_selector();
         $es->description = 'Getting child sites of this site';
         $es->add_type(id_of('site'));
         $es->add_left_relationship($this->site_id, relationship_id_of('parent_site'));
         $es->set_order('entity.name');
         if ($site->get_value('site_state') == 'Live') {
             $es->add_relation('site_state="Live"');
         }
         $this->child_sites = $es->run_one();
     }
 }
コード例 #4
0
 function init($args = array())
 {
     parent::init($args);
     $root_id = $this->parent->pages->root_node();
     $this_page_id = $this->cur_page->id();
     // check to see if this is a home page -- don't even query for siblings
     if ($root_id != $this_page_id) {
         $parent_id = $this->parent->pages->parent($this->cur_page->id());
         if (!empty($parent_id)) {
             $sibling_ids = $this->parent->pages->children($parent_id);
             if (!empty($sibling_ids)) {
                 foreach ($sibling_ids as $sibling_id) {
                     if ($sibling_id != $root_id) {
                         $page = new entity($sibling_id);
                         if ($this->params['show_only_pages_in_nav'] && $page->get_value('nav_display') != 'Yes') {
                             continue;
                         }
                         if (isset($this->params['show_external_links']) && !$this->params['show_external_links'] && $page->get_value('url')) {
                             continue;
                         }
                         $this->siblings[$sibling_id] = $page;
                     }
                 }
             }
             $this->parent_page = new entity($parent_id);
         }
     }
 }
コード例 #5
0
 function init($args = array())
 {
     parent::init($args);
     // If we're in ajax mode, we just return the data and quit the module.
     $api = $this->get_api();
     if ($api && $api->get_name() == 'standalone') {
         if (isset($this->request['subject'])) {
             $this->do_course_lookup($this->request['subject']);
             exit;
         }
         if (isset($this->request['toggle_course'])) {
             echo json_encode($this->do_course_toggle($this->request['toggle_course']));
             exit;
         }
     }
     $this->build_course_list();
     // Register inline editing
     $inline_edit =& get_reason_inline_editing($this->page_id);
     $inline_edit->register_module($this, $this->user_can_inline_edit());
     if ($head_items = $this->get_head_items()) {
         $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/courses/list.css');
         if ($inline_edit->active_for_module($this)) {
             $head_items->add_javascript(JQUERY_URL, true);
             $head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'jquery.reasonAjax.js');
             $head_items->add_javascript(REASON_HTTP_BASE_PATH . 'modules/courses/course_picker.js');
         }
     }
 }
コード例 #6
0
 function init($args = array())
 {
     parent::init($args);
     if ($this->params['mode'] == 'parent') {
         $children_ids = $this->parent->pages->children($this->page_id);
         reset($children_ids);
         $first_child = current($children_ids);
         $destination = $this->parent->pages->get_full_url($first_child, true);
         header('Location: ' . $destination);
         die;
     }
     $parent_page_id = $this->parent->pages->parent($this->page_id);
     $this->_parent_page = new entity($parent_page_id);
     $children_ids = $this->parent->pages->children($parent_page_id);
     foreach ($children_ids as $sibling_id) {
         $this->_siblings[$sibling_id] = new entity($sibling_id);
         $tab_title = $this->_siblings[$sibling_id]->get_value('link_name') ? $this->_siblings[$sibling_id]->get_value('link_name') : $this->_siblings[$sibling_id]->get_value('name');
         $this->_siblings[$sibling_id]->set_value('tab_title', $tab_title);
         $tab_link = $this->_siblings[$sibling_id]->get_value('url') ? $this->_siblings[$sibling_id]->get_value('url') : $this->parent->pages->get_full_url($sibling_id);
         $this->_siblings[$sibling_id]->set_value('tab_link', $tab_link);
     }
     if (!empty($this->params['css'])) {
         $this->parent->add_stylesheet($this->params['css']);
     } else {
         $this->parent->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/basic_sibling_tabs.css');
     }
 }
コード例 #7
0
ファイル: blurb.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     if (!empty($this->params['blurb_unique_names_to_show'])) {
         $this->build_blurbs_array_using_unique_names();
     } else {
         $this->es = new entity_selector();
         $this->es->description = 'Selcting blurbs for this page';
         $this->es->add_type(id_of('text_blurb'));
         $page_id = $this->get_source_page_id();
         $this->es->add_right_relationship($page_id, relationship_id_of('minisite_page_to_text_blurb'));
         $this->es->add_rel_sort_field($page_id, relationship_id_of('minisite_page_to_text_blurb'), 'rel_sort_order');
         if ($this->params['rand_flag']) {
             $this->es->set_order('rand()');
         } else {
             $this->es->set_order('rel_sort_order ASC');
         }
         if ($this->params['exclude_shown_blurbs']) {
             $already_displayed = $this->used_blurbs();
         }
         if (!empty($already_displayed)) {
             $this->es->add_relation('entity.id NOT IN (' . join(',', $already_displayed) . ')');
         }
         if (!empty($this->params['num_to_display'])) {
             $this->es->set_num($this->params['num_to_display']);
         }
         $this->blurbs = $this->es->run_one();
     }
     $this->used_blurbs(array_keys($this->blurbs));
     // register myself as editable if there are any blurbs ...
     if (!empty($this->blurbs)) {
         $inline_edit =& get_reason_inline_editing($this->page_id);
         $inline_edit->register_module($this, $this->user_can_inline_edit());
     }
 }
コード例 #8
0
ファイル: module.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     if ($head_items = $this->get_head_items()) {
         $template = $this->_get_template();
         $template->add_head_items($head_items);
     }
 }
コード例 #9
0
 function init($args = array())
 {
     parent::init($args);
     // force secure form due to a bug that causes images not to work in unsecure environment
     if (!on_secure_page()) {
         reason_include_once('function_libraries/user_functions.php');
         force_secure_if_available();
     }
 }
コード例 #10
0
ファイル: form.php プロジェクト: hunter2814/reason_package
 /** 
  * Invokes the controller init method
  */
 function init($args = array())
 {
     $this->_init_legacy();
     if ($this->model_is_usable()) {
         $controller =& $this->get_form_controller();
         $controller->init();
     } else {
         parent::init();
     }
 }
コード例 #11
0
ファイル: jobs.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     $this->job_type = new entity(id_of('job'));
     $this->job_type_id = $this->job_type->id();
     $this->init_list();
     if (!empty($this->request['job_id']) && empty($this->jobs[$this->request['job_id']])) {
         http_response_code(404);
     }
 }
コード例 #12
0
 function init($args = array())
 {
     parent::init($args);
     $s = new entity_selector();
     $s->add_type(id_of('site'));
     $s->set_order('entity.name');
     $s->add_relation('site.site_state = "Live"');
     $this->site_count = $s->get_one_count();
     $this->sites = $s->run_one();
     //pray($this->sites);
 }
コード例 #13
0
 function init($args = array())
 {
     if ($this->params['integration_library'] && in_array($this->params['integration_library'], $GLOBALS['UPLOADABLE_MEDIA_WORK_INTEGRATION_LIBRARIES'])) {
         $this->_integration_library = $this->params['integration_library'];
         $this->get_head_items()->add_javascript(REASON_HTTP_BASE_PATH . 'modules/media_import/media_import.js');
         $this->get_head_items()->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/media_import/media_import.css');
         $this->shim = MediaWorkFactory::shim($this->_integration_library);
     }
     force_secure_if_available();
     parent::init($args);
 }
コード例 #14
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();
 }
コード例 #15
0
ファイル: atoz.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     // find all the sites
     $es = new entity_selector();
     $es->description = "Getting all live sites";
     $es->add_type(id_of('site'));
     $es->add_relation('site.site_state = "Live"');
     $this->sites = $es->run_one();
     // find all non-reason sites
     $es2 = new entity_selector();
     $es2->description = 'Getting all non-reason sites';
     $es2->add_type(id_of('non_reason_site_type'));
     $this->non_reason_sites = $es2->run_one();
 }
コード例 #16
0
 function init($args = array())
 {
     parent::init($args);
     //Add necesary head items
     $head_items = $this->get_head_items();
     $slideshowConfig = $this->params;
     $slideshowConfig["headItemsObj"] = $head_items;
     $this->slideshow = new SlideshowStandalone($slideshowConfig);
     $this->select_images();
     if (empty($this->images)) {
         //return here since there will not be a slide show with no images.
         return;
     }
     $this->slideshow->setImages($this->images);
 }
コード例 #17
0
ファイル: gallery.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     $es = new entity_selector();
     $es->description = 'Selecting images for the gallery';
     $es->add_type(id_of('image'));
     $es = $this->refine_es($es);
     if (!empty($this->request['search_image'])) {
         $es->add_relation('(entity.name LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%" OR meta.description LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%"' . ' OR meta.keywords LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%"' . ' OR chunk.content LIKE "%' . reason_sql_string_escape($this->request['search_image']) . '%"' . ')');
     }
     $this->num = $es->get_one_count();
     $this->check_bounds();
     $es->set_num($this->num_per_page);
     $es->set_start(($this->request['page'] - 1) * $this->num_per_page);
     $this->images = $es->run_one();
 }
コード例 #18
0
 function init($args = array())
 {
     parent::init($args);
     if (!$this->get_authentication()) {
         $extra_params = '';
         if (!empty($this->msg_uname)) {
             $extra_params .= '&msg_uname=' . $this->msg_uname;
         }
         if (!empty($this->redir_link_text)) {
             $extra_params .= '&redir_link_text=' . $this->redir_link_text;
         }
         $dest_page = urlencode(get_current_url());
         header('Location: ' . REASON_LOGIN_URL . '?dest_page=' . $dest_page . $extra_params);
         exit;
     }
 }
コード例 #19
0
ファイル: policy.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     // REASON_USES_DISTRIBUTED_AUDIENCE_MODEL
     if (REASON_USES_DISTRIBUTED_AUDIENCE_MODEL) {
         $es = new entity_selector($this->site_id);
     } else {
         $es = new entity_selector();
     }
     $es->add_type(id_of('audience_type'));
     $this->all_audiences = $es->run_one();
     $head =& $this->get_head_items();
     $head->add_javascript('/reason_package/reason_4.0/www/js/policy_selector.js');
     if (!$this->_in_show_all_mode()) {
         if (!empty($this->request['policy_id'])) {
             $roots = $this->get_root_nodes();
             if (array_key_exists($this->request['policy_id'], $roots)) {
                 $this->policy = $roots[$this->request['policy_id']];
                 $this->_add_crumb($this->policy->get_value('name'), get_current_url());
                 $head_items = $this->get_head_items();
                 if ($this->policy->get_value('keywords')) {
                     $head_items->add_head_item('meta', array('name' => 'keywords', 'value' => reason_htmlspecialchars($this->policy->get_value('keywords'))));
                 }
                 if ($audience = $this->_get_current_audience()) {
                     $head_items->add_head_item('link', array('rel' => 'canonical', 'href' => $this->get_no_audience_link()));
                 }
                 if ($pages =& $this->get_page_nav()) {
                     $pages->make_current_page_a_link();
                 }
                 $access = $this->_get_access_result($this->policy);
                 if (false === $access) {
                     http_response_code(403);
                 } elseif (null === $access) {
                     http_response_code(401);
                 }
             } else {
                 http_response_code(404);
             }
         }
     }
     // register the module for inline editing
     $inline_edit =& get_reason_inline_editing($this->page_id);
     $inline_edit->register_module($this, $this->user_can_inline_edit($this->policy));
     if ($inline_edit->available_for_module($this)) {
         $head->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/policy/policy_editable.css', '', true);
     }
 }
コード例 #20
0
 function init($args = array())
 {
     parent::init($args);
     $rel_url = $this->get_feed_relationship_url();
     if (!empty($rel_url)) {
         $this->feed_location = $rel_url;
         $this->is_remote = true;
     } elseif (!empty($this->params['feed_location'])) {
         $this->feed_location = $this->params['feed_location'];
         $this->is_remote = $this->params['is_remote'];
     }
     if (!empty($this->params['display_timestamp'])) {
         $this->display_timestamp = $this->params['display_timestamp'];
     }
     if (!empty($this->params['show_entries_lacking_description'])) {
         $this->_show_entries_lacking_description = $this->params['show_entries_lacking_description'];
     }
     if (!empty($this->params['disable_cache'])) {
         $this->disable_cache = $this->params['disable_cache'];
     }
 }
コード例 #21
0
 function init($args = array())
 {
     parent::init($args);
     // If we're in ajax mode, we just return the data and quit the module.
     $api = $this->get_api();
     if ($api && $api->get_name() == 'standalone') {
         if (isset($this->request['subject'])) {
             $this->do_course_lookup($this->request['subject']);
             exit;
         }
         if (isset($this->request['toggle_course'])) {
             echo json_encode($this->do_course_toggle($this->request['toggle_course']));
             exit;
         }
     }
     //$this->build_course_list();
     if ($head_items = $this->get_head_items()) {
         $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/courses/manage_courses.css');
         //$head_items->add_javascript(JQUERY_URL, true);
         //$head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'jquery.reasonAjax.js');
         $head_items->add_javascript(REASON_HTTP_BASE_PATH . 'modules/courses/manage_courses.js');
     }
 }
コード例 #22
0
ファイル: sitemap.php プロジェクト: hunter2814/reason_package
 function init($args = array())
 {
     parent::init($args);
     $this->id_of_site_type = id_of('site');
     $this->id_of_non_reason_site_type = id_of('non_reason_site_type');
     if (!empty($this->params['site_types_unique_names'])) {
         foreach ($this->params['site_types_unique_names'] as $cat_name => $unique_name_array) {
             foreach ($unique_name_array as $unique_name) {
                 $this->site_types[$cat_name][] = id_of($unique_name);
             }
         }
     } else {
         $es = new entity_selector(id_of('master_admin'));
         $es->add_type(id_of('site_type_type'));
         $es->add_relation('((show_hide.show_hide IS NULL) OR (show_hide.show_hide = "show"))');
         $es->set_order('sortable.sort_order ASC');
         $result = $es->run_one();
         foreach ($result as $e) {
             $cat_name = $e->get_value('name');
             $this->site_types[$cat_name][] = $e->id();
         }
     }
 }
コード例 #23
0
 function init($args = array())
 {
     parent::init($args);
     // If we're in ajax mode, we just return the data and quit the module.
     $api = $this->get_api();
     if ($api && $api->get_name() == 'standalone') {
         if (isset($this->request['subject'])) {
             $this->do_course_lookup($this->request['subject']);
             exit;
         }
         if (isset($this->request['toggle_course'])) {
             echo json_encode($this->do_course_toggle($this->request['toggle_course']));
             exit;
         }
     }
     //$this->build_course_list();
     if ($head_items = $this->get_head_items()) {
         $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/courses/manage_courses.css');
         //$head_items->add_javascript(JQUERY_URL, true);
         //$head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'jquery.reasonAjax.js');
         $head_items->add_javascript(REASON_HTTP_BASE_PATH . 'modules/courses/manage_courses.js');
     }
     if (isset($this->request['course'])) {
         $this->course = new CourseTemplateType($this->request['course']);
         $this->form = new disco();
         $this->form->box_class = 'StackedBox';
         $this->form->elements = $this->elements;
         $this->form->required = $this->required;
         $this->form->actions = array('submit' => 'Save Course');
         $this->form->error_header_text = 'There\'s a problem:';
         //$this->form->add_callback(array(&$this, 'pre_show_form'),'pre_show_form');
         $this->form->add_callback(array(&$this, 'process_editor_submission'), 'process');
         //$this->form->add_callback(array(&$this, 'run_error_checks'),'run_error_checks');
         $this->form->add_callback(array(&$this, 'where_to'), 'where_to');
         $this->form->init();
     }
 }
コード例 #24
0
ファイル: generic3.php プロジェクト: natepixel/reason_package
		function init($args = array()) // {{{
		{
			$error = 'Your class needs to have a type id.  Please overload the set_type() function and '.
					 'include a line such as $this->type = id_of( "something" ) to run this module.';
			parent::init( $args );
			$this->set_type();
			if( empty( $this->type ) )
				trigger_error( $error , E_USER_ERROR );
				
			if(!empty($this->request[ $this->query_string_frag.'_id' ]))
				$this->current_item_id = $this->request[ $this->query_string_frag.'_id' ];
				
			if(!empty($this->params['wrapper_id_string']))
			{
				$this->style_string = $this->params['wrapper_id_string'];
			}
			
			$this->additional_init_actions();
			$this->pre_es_additional_init_actions();
					
			if(empty($this->request['add_item']));
			{
				$this->es = $this->_create_primary_entity_selector();
				$this->alter_es();
				
				// We want to "archive" a version of the entity selector
				// just before the filters are applied
				$this->pre_user_input_es = carl_clone($this->es);				
				$this->apply_user_input_to_es();
				if($this->use_filters)
					$this->do_filtering();
				
				
				// So the idea here is to grab an array of ids of all of the elements
				// that would appear on a full list of the module. From this we can
				// easily find an item's position relative to the list and next and
				// previous items.
				
				// If we're viewing a single item and have no list below the item,
				// we simply want to get the id list and put the current item into
				// the items array
				if (!$this->show_list_with_details && !empty($this->current_item_id))
				{
					$this->es->limit_fields('entity.id');
					$this->es->exclude_tables_dynamically();
					$this->ids = $this->es->run_one();
					
					// make sure the currently selected item has all fields needed (e.g. relationship fields, etc.)
					$item_es = carl_clone($this->es);
					$item_es->add_relation('entity.id = "'.$this->current_item_id.'"');
					$item_es->set_num(1);
					$item_array = $item_es->run_one();
					
					if(!empty($item_array))
					{
						$item = current($item_array);
						$this->items[$item->id()] = $item;
					}
					
					$this->refine_ids_and_positions_arrays();
				}
				else
				{
					// when we are using a bunch of relationship filters AND searching across a big table like the chunk table, mysql can take a really
					// long time figuring out how to optimize the query. Forcing a straight join appears to address this issue. Note that this will only
					// ever be run if you configure max_filters is equal to or greater than the straight_join_filter_threshold.
					if ($this->use_filters && !empty($this->request['filters']) && !empty($this->request['search']))
					{
						if (isset($this->params['straight_join_filter_threshold']) && is_numeric($this->params['straight_join_filter_threshold']))
						{
							if (count($this->request['filters']) >= $this->params['straight_join_filter_threshold'])
							{
								$this->es->optimize('STRAIGHT_JOIN');
							}
						}
					}									  
					
					// If we have a list, either below an item or by itself, and also
					// have pagination, we want to basically grab the current page's
					// "chunk" of items as before and put it into $this->items
					if ($this->use_pagination)
					{
						$all_ids_es = carl_clone($this->es);
						$all_ids_es->limit_fields(array('entity.id'));
						$all_ids_es->exclude_tables_dynamically();
						$this->ids = $all_ids_es->run_one(); 
						
						$this->refine_ids_and_positions_arrays();
						
						// We want to define what page the current item should
						// be on so we know how to do pagination
						if (!empty($this->current_item_id) && ($page_num = $this->get_page_number_from_id($this->current_item_id)))
						{
							$this->request['page'] = $page_num;
						}
						$this->do_pagination(); // This needs to go last before calling "run_one."
						$this->items = $this->es->run_one();
						$this->alter_items($this->items);
					}
					// If we have a list with no pagination, we grab all information
					// about all items for the array of ids and the items array.
					else
					{
						$this->es->exclude_tables_dynamically();
						$this->items = $this->ids = $this->es->run_one();
						$this->refine_ids_and_positions_arrays();
						$this->alter_items($this->items);
					}
				}
				
				if( !empty( $this->items ) && !empty( $this->current_item_id ) && !empty($this->items[$this->current_item_id]) )
				{
					$this->add_crumb();
				}
				if(
					$this->make_current_page_link_in_nav_when_on_item
					&&
					!empty($this->current_item_id)
					&&
					$pages_object =& $this->get_page_nav()
				)
				{
					$pages_object->make_current_page_a_link();
				}
				if($this->has_feed)
				{
					$this->add_feed_to_head();
				}
				if($this->use_other_page_name_as_module_title)
				{
					$this->get_path_to_link_target_page();
					if(!empty($this->link_target_page))
					{
						$this->module_title = $this->link_target_page->get_value('name');
					}
				}
				if(!empty( $this->current_item_id ))
				{
					$this->check_id( $this->current_item_id );
				}
				$this->post_es_additional_init_actions();
			}
		} // }}}
コード例 #25
0
ファイル: default.php プロジェクト: hunter2814/reason_package
 /**
  * Return an array of APIs supported by the class tree.
  *
  * We require class_name and use reflection for now since only php 5.3 and above supports late static binding.
  */
 static final function get_supported_apis($class_name)
 {
     static $supported_apis;
     if (empty($class_name) || !class_exists($class_name)) {
         trigger_error('get_supported_apis must be provided the name of a defined class.');
     } elseif (!isset($supported_apis[$class_name])) {
         self::$classname = $class_name;
         // providing context for add_api
         while ($class = isset($class) ? $class->getParentClass() : new ReflectionClass($class_name)) {
             if ($class->getMethod('setup_supported_apis')->getDeclaringClass()->getName() == $class->getName()) {
                 $class->getMethod('setup_supported_apis')->invoke(NULL);
             }
         }
         $supported_apis[$class_name] = self::_api_helper('get');
         self::$classname = NULL;
     }
     return $supported_apis[$class_name];
 }
コード例 #26
0
 /**
  * We run the api we setup in setup_supported_apis()
  *
  * Note that we ask for the content type and set the content differently for the json and html content types.
  *
  * If the content type is not 'json' or 'html', note that we run the api anyway, as it supports standard error cases.
  */
 function run_api()
 {
     $api = $this->get_api();
     if ($api->get_name() == 'random_number') {
         if ($api->get_content_type() == 'json') {
             $api->set_content(json_encode(array('random_number' => $this->get_random_number())));
         }
         if ($api->get_content_type() == 'html') {
             $api->set_content('<p>' . $this->get_random_number() . '</p>');
         }
         $api->run();
     } else {
         parent::run_api();
     }
     // support other apis defined by parents
 }
コード例 #27
0
		function init( $args = array() )
		{
			parent::init( $args );
			//Add necesary head items
			$head_items = $this->get_head_items();
			$head_items->add_javascript(JQUERY_URL, true);
			$head_items->add_javascript(REASON_PACKAGE_HTTP_BASE_PATH . 'FlexSlider/jquery.flexslider.js');
			$head_items->add_stylesheet(REASON_PACKAGE_HTTP_BASE_PATH . 'FlexSlider/flexslider.css');
						
			$this->select_images();

			if (empty($this->images))
			{
				//return here since there will not be a slide show with no images.
				return;
			}
			
			// Find the max height and width of the slide show considering picture sizes and given
			// height and width parameters.
			$this->max_height = $this->params['height'];
			$this->max_width = $this->params['width'];
			if( empty($this->params['height']) || empty($this->params['width']))
			{
				foreach($this->images as $img)
				{
					if (empty($this->params['height']) && $img->get_value('height') > $this->max_height)
					{
						$this->max_height = $img->get_value('height');
					}
					if (empty($this->params['width']) &&$img->get_value('width') > $this->max_width)
					{
						$this->max_width = $img->get_value('width');
					}
				}
			}
			$this->aspect_ratio = $this->max_height / $this->max_width;			
			
			//define the javascirpt functions needed for sizing the slideshow to preserve the aspect ratio and add them to the head.
			$slider_hookup_js = '
								var slider_width;
			
								$(window).load(function() {
																			
    								$(".flexslider").flexslider({ 
    									'. $this->get_flexslider_properties() . '
    								
    									after: function(slider){
    										handleResizing();
    									}
    								});
    								
    								handleResizing();
								});
								
								function handleResizing() {
									var width = $(".flexslider").width();
									var height = width * '. $this->aspect_ratio .';
									
									$(".slide-img").each(function() {
										var margin = getMarginTop($(this),height, width);
										$(this).css("margin-top", margin);
									});

									$(".flexslider-img").css("height",height);
									$(".listelement").css("height", height);
									$(".flexslider").css("height",height);
								}
								
								function getMarginTop(img, height_of_frame, width_of_frame){
									if (height_of_frame < img.attr("init_height") || width_of_frame < img.attr("init_width")) {
										if ('.$this->aspect_ratio.' > (img.attr("init_height")/img.attr("init_width"))) {
											frame_height_when_shrink_began = '.$this->aspect_ratio.' * img.attr("init_width");
										} else {
											frame_height_when_shrink_began = img.attr("init_height");
										}
										cur_height_of_image = img.attr("init_height") * (height_of_frame / frame_height_when_shrink_began);
									} else {
										cur_height_of_image = img.attr("init_height");
									}
									return (height_of_frame - cur_height_of_image) / 2;
								}
									  
								$(window).resize(handleResizing);
								
								$(document).ready(function() {
									handleResizing();
									$(".flexslider").removeClass("jsOff");
								});';
			
			$head_items->add_head_item('script', array('type' => 'text/javascript', 'charset' => 'utf-8'), $slider_hookup_js);
			
			/* Add slideshow related css to the head */
			$css = '.flexslider {
						max-width:'. $this->max_width .'px;
						background: rgba(0,0,0,.6);
						background: #444 \9;
						border: 0;
						border-radius: 0;
					}
					div.flexslider li.listelement {
						margin-top:0px !important;
						margin-bottom: 0 !important;
						margin-left: 0 !important;
					}
					img.slide-img {
						position:static !important;
						margin-left:auto !important;
						max-width:100% !important; 
						margin-right:auto !important; 
						max-height:100% !important;
						-ms-filter:inherit; This line needed to force IE8 to fade out slides
						/* opacity:inherit; /*This line needed to force IE8 to fade out captions*/
					}
					ul.slides {
						margin-left: 0 !important;
						margin-right: 0 !important;
						margin-top: 0 !important;
						margin-bottom: 0 !important;
					}
					div.flexslider-img {
						-ms-filter:inherit; /*This line needed to force IE8 to fade out slides*/
					}
					p.flex-caption {
						margin: 0 !important;
						background: rgba(0,0,0,.7);
						font-size: 9pt;
						/* opacity:inherit; /*This line needed to force IE8 to fade out captions*/
						//-ms-filter:inherit;
						//filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4C000000,endColorstr=#4C000000); ZOOM: 1;
					}
					p.flex-caption strong.shortCaption, p.flex-caption span.longCaption {
						display:block;
					}
					div.flexslider.jsOff li {
						display: block !important;
					}
					td .flexslider {
						width:'. $this->max_width .'px;
					}
					
					/*arrow css for browsers that do not support opacity:*/
				
					.flex-direction-nav li a {
						width: 32px; 
						height: 54px;
						margin: -27px 0 0;
						background: url('.REASON_PACKAGE_HTTP_BASE_PATH . 'FlexSlider/theme/arrows_4up_8bit.png) no-repeat;
						}
					.flexslider:hover .flex-direction-nav li .next {
						background-position: -32px -54px;
					}
					.flexslider:hover .flex-direction-nav li .prev {
						background-position: 0 -54px;
					}
					.flex-direction-nav li .next {
						background-position: -32px 0; right: 0px;
					}
					.flex-direction-nav li .prev {
						left: 0px;
					}
							
					/*arrow css for browsers that do support opacity:*/

					.opacity .flex-direction-nav li a {
						width: 32px; 
						height: 54px;
						margin: -27px 0 0;
						background: url('.REASON_PACKAGE_HTTP_BASE_PATH . 'FlexSlider/theme/arrows_sprited_8bit.png) no-repeat;
						opacity: .6;
						transition: opacity .25s ease-in-out;
						-moz-transition: opacity .25s ease-in-out;
						-webkit-transition: opacity .25s ease-in-out;}
					.opacity .flexslider:hover .flex-direction-nav li .next {
						background-position: -32px 0; right: 0px;
						opacity: 1;
					}
					.opacity .flexslider:hover .flex-direction-nav li .prev {
						background-position: 0px 0px;
						opacity: 1;
					}
					.opacity .flex-direction-nav li .next {
						background-position: -32px 0; right: 0px;
					}
					.opacity .flex-direction-nav li .prev {
						left: 0px;
					}
				
					';
			
			$head_items->add_head_item('style', array('type' => 'text/css', 'charset' => 'utf-8'), $css);		
			
			$opacity_class_css = '/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
			 * Build: http://modernizr.com/download/#-opacity-cssclasses-prefixes
			 */
			;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(m.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.5.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.opacity=function(){return w("opacity:.55"),/^0.55$/.test(j.opacity)};for(var A in n)u(n,A)&&(s=A.toLowerCase(),e[s]=n[A](),q.push((e[s]?"":"no-")+s));return v(""),i=k=null,e._version=d,e._prefixes=m,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document);';
			
			$head_items->add_head_item('script', array('type' => 'text/javascript', 'charset' => 'utf-8'), $opacity_class_css);
			
			
			// Provide border-box sizing for bropwsers that can handle it (i.e. not ie 7-)
			$box_css = '#meat .flex-caption {box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; width:100%}';
			$head_items->add_head_item('style', array('type' => 'text/css', 'charset' => 'utf-8'), $box_css, $add_to_top = false, $wrapper = array('before' => '<!--[if !IE 7]><!-->', 'after' => '<!-- <![endif]-->'));
			
		}
コード例 #28
0
 function run_api()
 {
     $api = $this->get_api();
     if ($api->get_name() == 'image_detail') {
         if ($api->get_content_type() == 'html') {
             $api->set_content($this->get_image_detail_content());
         }
         $api->run();
     } else {
         parent::run_api();
     }
     // support other apis defined by parents
 }
コード例 #29
0
 function init($args = array())
 {
     parent::init($args);
     $this->get_head_items()->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/map/map.css');
 }
コード例 #30
0
ファイル: events.php プロジェクト: natepixel/reason_package
	/**
	 * Initialize the module
	 */
	function init( $args = array() )
	{
		parent::init( $args );
		
		if(!empty($this->params['list_type']))
		{
			if('verbose' == $this->params['list_type'] && '' == $this->params['list_item_markup'])
			{
				$this->params['list_item_markup'] = 'minisite_templates/modules/events_markup/verbose/verbose_events_list_item.php';
				trigger_error('Events module: list_type parameter is deprecated and will stop working in Reason 4.6. Please specify "list_item_markup" => "'.$this->params['list_item_markup'].'" instead.');
			}
			elseif('schedule' == $this->params['list_type'] && '' == $this->params['list_markup'])
			{
				$this->params['list_markup'] = 'minisite_templates/modules/events_markup/schedule/schedule_events_list.php';
				$this->params['list_item_markup'] = 'minisite_templates/modules/events_markup/schedule/schedule_events_list_item.php';
				trigger_error('Events module: list_type parameter is deprecated and will stop working in Reason 4.6. Please specify "list_markup" => "'.$this->params['list_markup'].'", "list_item_markup" => "'.$this->params['list_item_markup'].'" instead.');
			}
		}
		
		$this->validate_inputs();
		
		$this->register_passables();
		
		$this->handle_jump();
				
		if(empty($this->request['event_id']))
		{
			$this->init_list();
		}
		else
			$this->init_event();		
		$inline_edit =& get_reason_inline_editing($this->page_id);
		$inline_edit->register_module($this, $this->user_can_inline_edit());
		if ($inline_edit->active_for_module($this))
		{
			$user = reason_get_current_user_entity();
			$event_id = $this->request['event_id'];
			/* Event adding is currently not functional
			if( !($event_id = $this->request['event_id'] ) )
			{
				if(reason_user_has_privs($user->id(), 'add' ))
				{
					if ($event_id = create_entity( $this->site_id, id_of('event_type'), $user->id(), '', array( 'entity' => array( 'state' => 'Pending' ) ) ))
					{					
						// We have to do a few things to trick the module into
						// recognizing a new event
						$this->request['event_id'] = $event_id;
						$this->init_event();
						$this->_ok_to_show[$event_id] = true;
					}
				}
			}*/
			
			if ($user && $event = new entity($event_id))
			{
				reason_include_once('classes/admin/admin_page.php');
				reason_include_once('classes/admin/modules/editor.php');
				$site = $event->get_owner();
				
				// Create a new admin page object and set some values to make it
				// think it's running in the admin context.
				$admin_page = new AdminPage();
				$admin_page->id = $event->id();
				$admin_page->site_id = $site->id();
				$admin_page->type_id = id_of('event_type');
				$admin_page->user_id = $user->id(); 
				$admin_page->request = array();
				$admin_page->head_items =& $this->get_head_items();
	
				// Create a new editor with the admin page. This will pick the 
				// appropriate editor class and set up the disco form.
				$this->edit_handler = new EditorModule( $admin_page );
				$this->edit_handler->head_items =& $this->get_head_items();
				$this->edit_handler->init();
				
				$this->edit_handler->disco_item->actions = array('finish' => 'Save');
				$this->edit_handler->disco_item->add_callback(array($this,'editor_where_to'),'where_to');
			}
		}
		if(!empty($this->params['wrapper_id']))
			$this->div_id = $this->params['wrapper_id'];
		
		// get_run_output() should be the very last thing done before the end of init()
		// This is done to allow the markup classes to add head items
		$this->get_run_output();
	}