function run() { if (empty($this->admin_page->site_id)) { echo '<p>Please pick a site first to use this module.</p>' . "\n"; return; } // pick library if (!$this->integration_library) { echo '<p>Place pick the integration library you are using.</p>' . "\n"; $this->display_libraries(); return; } elseif ($this->integration_library == 'invalid_library') { echo '<p>' . $this->admin_page->request['integration_library'] . ' is an invalid integration library.</p>' . "\n"; echo '<p>Please choose from the following integration libraries:</p>' . "\n"; $this->display_libraries(); return; } $d = new Disco(); $d->form_enctype = 'multipart/form-data'; $d->add_callback(array($this, 'get_instructions'), 'pre_show_form'); $d->add_element('zip_file', 'ReasonUpload', array('acceptable_extensions' => array('zip'))); $d->add_element('url_comment', 'comment', array('text' => '<strong>File larger than the maximum upload size?</strong> Put it in a web-available location and enter its web address below.')); $d->add_element('zip_file_url'); $d->add_callback(array($this, 'error_check'), 'run_error_checks'); $d->add_callback(array($this, 'process_form'), 'process'); $d->run(); }
function run_editable() { // Show a small disco inline editing form if it is activated, display the title // and an activation button if not. $inline_edit =& get_reason_inline_editing($this->page_id); $active = $inline_edit->active_for_module($this); $class = $active ? 'editable editing' : 'editable'; echo '<div class="' . $class . '">' . "\n"; if ($inline_edit->active_for_module($this)) { $form = new Disco(); $form->strip_tags_from_user_input = true; $form->allowable_HTML_tags = ''; $form->add_element('page_title', 'text'); $form->set_value('page_title', $this->parent->title); $form->add_required('page_title'); $form->add_callback(array(&$this, 'process_editable'), 'process'); $form->add_callback(array(&$this, 'where_to_editable'), 'where_to'); $form->run(); } else { $url = carl_make_link($inline_edit->get_activation_params($this)); $link = '<p><a href="' . $url . '" class="editThis">Edit Page Title</a></p>' . "\n"; $pre = '<div class="editRegion">' . "\n"; $post = '</div>' . "\n"; $output = $pre . $this->get_formatted_page_title() . $link . $post; echo $output; } echo '</div>' . "\n"; }
/** * Present an interface to edit / create content */ function run_editable() { $inline_edit =& get_reason_inline_editing($this->page_id); $active = $inline_edit->active_for_module($this); $class = $active ? 'editable editing' : 'editable'; echo '<div id="pageContent" class="' . $class . '">' . "\n"; if ($active) { $form = new Disco(); $form->strip_tags_from_user_input = true; $form->allowable_HTML_tags = REASON_DEFAULT_ALLOWED_TAGS; $form->actions = array('save' => 'Save', 'save_and_finish' => 'Save and Finish Editing'); $form->add_element('editable_content', html_editor_name($this->site_id), html_editor_params($this->site_id, $this->get_html_editor_user_id())); $form->set_display_name('editable_content', ' '); $form->set_value('editable_content', $this->content); $form->add_callback(array(&$this, 'process_editable'), 'process'); $form->add_callback(array(&$this, 'where_to_editable'), 'where_to'); $form->run(); } else { $url = carl_make_link($inline_edit->get_activation_params($this)); if (!carl_empty_html($this->content)) { $link = '<p><a href="' . $url . '" class="editThis">Edit Content</a></p>'; $pre = '<div class="editRegion">'; $post = '</div>'; $output = $pre . $this->content . $link . $post; } else { $link = '<p><a href="' . $url . '" class="editThis">Create Content</a></p>'; $pre = '<div class="editRegion">'; $post = '</div>'; $output = $pre . $link . $post; } echo $output; } echo '</div>' . "\n"; }
/** * Run the group tester * * @return void */ function run() { echo '<p>Use this form to see if a particular username will be part of this group</p>' . "\n"; $tester = new Disco(); $tester->init(true); $tester->add_element('username_to_check', 'text', array('display_name' => ' ')); $tester->actions = array('test' => 'Test this username'); $tester->run(); if (!empty($this->admin_page->request['username_to_check'])) { $username = $this->admin_page->request['username_to_check']; $gh = new group_helper(); $gh->set_group_by_entity($this->group); if ($gh->is_username_member_of_group($username)) { echo '<p><strong>Yes</strong>, ' . $username . ' is a member of this group.</p>' . "\n"; } else { echo '<p><strong>No</strong>, ' . $username . ' is not a member of this group.</p>' . "\n"; } } echo '<p><a href="' . $this->admin_page->make_link(array('cur_module' => 'Editor', 'mode' => '')) . '">Return to editing the group</a>'; }
function run() { if (!KalturaShim::kaltura_enabled()) { echo '<p>Sorry; in order to use this module your instance of Reason must be integrated with Kaltura</p>' . "\n"; return; } if (empty($this->admin_page->site_id)) { echo '<p>Please pick a site first to use this module.</p>' . "\n"; return; } // $this->admin_page->user_id // $this->admin_page->site_id $d = new Disco(); $d->form_enctype = 'multipart/form-data'; $d->add_callback(array($this, 'get_instructions'), 'pre_show_form'); $d->add_element('zip_file', 'ReasonUpload', array('acceptable_extensions' => array('zip'))); $d->add_element('url_comment', 'comment', array('text' => '<strong>File larger than the maximum upload size?</strong> Put it in a web-available location and enter its web address below.')); $d->add_element('zip_file_url'); $d->add_callback(array($this, 'error_check'), 'run_error_checks'); $d->add_callback(array($this, 'process_form'), 'process'); $d->run(); }
function run_form() { $form = new Disco(); $form->actions = array('save' => 'Use This Image'); $range_opts = $this->generate_range_options(); $form->add_element('thumbnails', 'range_slider', $range_opts); $form->set_display_name('thumbnails', 'Thumbnails'); // This element is merely a placeholder for the javascript to see $form->add_element('entry_id', 'hidden'); $form->set_value('entry_id', $this->media_work->get_value('entry_id')); $form->add_callback(array(&$this, 'process_form'), 'process'); $form->add_callback(array(&$this, 'where_to'), 'where_to'); $form->run(); }
function show_form() { $form = new Disco(); $form->strip_tags_from_user_input = true; if ($this->has_master_admin_edit_access) { $form->add_element('add_user', 'checkbox'); $form->set_display_name('add_user', 'Add self to site'); } if ($this->can_pose_as_other_user && $this->get_users_with_access()) { if ($this->has_master_admin_edit_access) { $form->add_element('or_comment', 'comment', array('text' => '<strong>OR</strong>')); } $form->add_element('user_list', 'select', array('options' => $this->build_usernames())); $form->set_display_name('user_list', 'Pose as a user with access'); } $form->add_callback(array(&$this, 'pre_show_form'), 'pre_show_form'); $form->add_callback(array(&$this, 'process'), 'process'); $form->add_callback(array(&$this, 'where_to'), 'where_to'); $form->run(); }
function run_form() { $form = new Disco(); $form->actions = array('save' => 'Use This Image'); $range_opts = $this->generate_range_options(); $form->add_element('seconds', 'range_slider', $range_opts); $form->set_display_name('seconds', 'Seconds into Video'); // This element is merely a placeholder for the javascript to see $form->add_element('entry_id', 'hidden'); $form->set_value('entry_id', $this->media_work->get_value('entry_id')); $form->add_element('service_url', 'hidden'); $form->set_value('service_url', KALTURA_SERVICE_URL); $form->add_element('partner_id', 'hidden'); $form->set_value('partner_id', KALTURA_PARTNER_ID); $form->add_callback(array(&$this, 'process_form'), 'process'); $form->add_callback(array(&$this, 'where_to'), 'where_to'); $form->run(); }
/** * Lists the top pages (views) and show analytics * * @return void */ function run() { $this->site_urls = $this->get_site_urls(); asort($this->site_urls); $site_types = $this->get_queryable_site_types(); $site_events = $this->get_site_type($this->has_events); $site_faq = $this->get_site_type($this->has_faq); $site_news = $this->get_site_type($this->has_news); $site_policies = $this->get_site_type($this->has_policies); $disco = new Disco(); $disco->add_element('content_id', 'hidden', array('userland_changeable' => true)); // placeholder for an entity's id $disco->add_element('content_type', 'radio_inline_no_sort', array('options' => $site_types)); $disco->add_element('url', 'chosen_select', array('options' => $this->site_urls, 'display_name' => 'URL(s)')); $disco->add_element('propagate', 'checkboxfirst', array('display_name' => 'Include this page\'s sub-pages (children and grandchildren)')); if ($site_events) { $disco->add_element('events', 'chosen_select', array('options' => $site_events, 'display_name' => 'Events')); } if ($site_faq) { $disco->add_element('faq', 'chosen_select', array('options' => $site_faq, 'display_name' => 'FAQs')); } if ($site_news) { $disco->add_element('news', 'chosen_select', array('options' => $site_news, 'display_name' => 'News / Posts')); } if ($site_policies) { $disco->add_element('policies', 'chosen_select', array('options' => $site_policies)); } $disco->add_element('location', 'radio_inline_no_sort', array('options' => array('anywhere' => 'Anywhere', 'off_campus' => 'Off-Campus', 'on_campus' => 'On-Campus'), 'default' => 'anywhere')); $disco->add_element('start_date', 'textdate'); $disco->add_element('end_date', 'textdate'); $disco->add_element('site_id', 'hidden'); $disco->set_value('site_id', $this->site->id()); $disco->add_element('cur_module', 'hidden'); $disco->set_value('cur_module', 'Analytics'); $disco->add_required('location'); $disco->add_required('start_date'); $disco->add_required('end_date'); $disco->set_actions(array('Get Analytics')); $disco->show_error_jumps = false; $error_checks_callback = array($this, 'error_check_disco'); $on_every_time_callback = array($this, 'on_every_time'); $disco->add_callback($error_checks_callback, 'run_error_checks'); $disco->add_callback($on_every_time_callback, 'pre_error_check_actions'); $disco->set_value('start_date', date('Y-m-d', strtotime('-1 month -1 day'))); $disco->set_value('end_date', date('Y-m-d', strtotime('-1 day'))); echo '<div id="analytics-module" class="noscript">' . "\n"; echo '<script>$("div").removeClass("noscript");</script>' . "\n"; $disco->run(); if (!$disco->has_errors()) { // Query Google Analytics and display results if any if ($this->get_ga_daily_data($disco)) { if ($this->get_ga_sources_data($disco)) { $totals = $this->daily_results->getTotalsForAllResults(); if ($totals['ga:pageviews'] != '(none)' && !is_null($this->source_results->getRows())) { $loc = $disco->get_value_for_display('location'); $location_text = $loc == 'Anywhere' ? '' : $loc . ' '; echo '<div class="results-title"><h3>' . $location_text . 'Results for ' . date("M d, Y", strtotime($disco->get_value('start_date'))) . ' - ' . date("M d, Y", strtotime($disco->get_value('end_date'))) . '</h3></div>' . "\n"; $prop = $disco->get_value('propagate'); $display_url = '<a href="http://' . GA_HOST_NAME . $disco->get_value_for_display("url") . '"target="_blank">' . $disco->get_value_for_display('url') . '</a>'; if ($disco->get_value('content_type') == id_of('minisite_page') && empty($this->admin_page->request['id'])) { $page_path_text = $prop == true ? '<em>' . $display_url . '</em> and all sub-pages' : '<em>' . $display_url . '</em>'; } else { $page_path_text = '<em>' . $this->admin_page->get_name($disco->get_value('content_id')) . '</em>'; } // Display total results echo '<div class="results-title"><h4>Totals for ' . $page_path_text . '</h4></div>' . "\n"; $this->about = new AnalyticsAbout(); echo '<div id="total-results">' . "\n"; echo '<div class="metric" title="' . $this->about->get_help('pageviews_help', 'text') . '">Pageviews<br /><strong>' . number_format($totals['ga:pageviews']) . '</strong></div>' . "\n"; echo '<div id="pageviews_metric"></div>' . "\n"; echo '<div class="metric" title="' . $this->about->get_help('unique_pageviews_help', 'text') . '">Unique Pageviews<br /><strong>' . number_format($totals['ga:uniquePageViews']) . '</strong></div>' . "\n"; echo '<div id="unique_pageviews_metric"></div>' . "\n"; echo '<div class="metric" title="' . $this->about->get_help('entrances_help', 'text') . '">Entrances<br /><strong>' . number_format($totals['ga:entrances']) . '</strong></div>' . "\n"; echo '<div id="entrances_metric"></div>' . "\n"; $pagetext = $disco->get_value('url') == 'all_pages' ? 'pages' : 'page'; echo '<div class="metric" title="' . $this->about->get_help('average_time_help', 'text') . '">Avg time on ' . $pagetext . '<br /><strong>' . gmdate("i:s", round($totals['ga:avgTimeOnPage'])) . '</strong></div>' . "\n"; echo '<div id="average_time_metric"></div>' . "\n"; echo '<div class="metric" title="' . $this->about->get_help('bounce_rate_help', 'text') . '">Bounce rate<br /><strong>' . round($totals['ga:entranceBounceRate'], 2) . '%</strong></div>' . "\n"; echo '<div id="bounce_rate_metric"></div>' . "\n"; echo '<div class="metric" title="' . $this->about->get_help('exit_rate_help', 'text') . '">Exit rate<br /><strong>' . round($totals['ga:exitRate'], 2) . '%</strong></div>' . "\n"; echo '<div id="exit_rate_metric"></div>' . "\n"; echo '<div style="clear: left;"></div>' . "\n"; echo '</div>' . "\n"; //total-results //Display daily results plot echo '<div class="results-title"><h4>Daily Results for ' . $page_path_text . '</h4></div>' . "\n"; echo '<div id="daily-results-div" class="jsdisabled">' . "\n"; echo $this->draw_ga_table($this->daily_results, 'daily_results'); echo '</div>' . "\n"; //daily-results echo '<div class="jsenabled">' . "\n"; if ($this->daily_results->getTotalResults() == 1) { echo $this->draw_ga_table($this->daily_results, 'daily_results'); } else { echo '<div id="placeholder" style="width:785px;height:300px;margin:20px"></div>' . "\n"; echo '<p>Click and drag on the overview plot below to change zoom level.<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/zoom.png" alt="Click-drag to Zoom" /></p>' . "\n"; echo '<div id="overview" style="margin-left:125px;margin-top:20px;width:600px;height:50px"></div>' . "\n"; } echo '</div>' . "\n"; //jsenabled //Display top 20 source results $top = $this->source_results->getTotalResults() > 20 ? '20' : $this->source_results->getTotalResults(); if (count($this->source_results->getRows()) == 1) { echo '<div class="results-title"><h4>Top <a title="' . $this->about->get_help('source_help', 'text') . '">Source</a> for ' . $page_path_text . '</h4></div>' . "\n"; } else { echo '<div class="results-title"><h4>Top ' . $top . ' <a title="' . $this->about->get_help('source_help', 'text') . '">Sources</a> for ' . $page_path_text . '</h4></div>' . "\n"; } echo '<div id="source_metric"></div>' . "\n"; echo '<div id="source-jsdisabled-div" class="jsdisabled">' . "\n"; echo $this->draw_ga_table($this->source_results, 'source_results'); echo '</div>' . "\n"; //source-results echo '<div id="source-jsenabled-div" class="jsenabled">' . "\n"; if (count($this->source_results->getRows()) == 1) { echo $this->draw_ga_table($this->source_results, 'source_results'); } else { echo '<div id="source-pie-chart" style="width:785px;height:375px;margin:20px"></div>' . "\n"; echo '<div id="source-pie-hover"></div>'; echo '</div>' . "\n"; //jsenabled } $this->draw_line_chart($this->daily_results); $this->draw_pie_chart($this->source_results); if (empty($this->admin_page->request['type_id'])) { /** * @todo include pages table */ // $pages = $this->get_query_url_array($this->site_urls, $this->page_results); echo '<div class="results-title"><h4>Pages</h4></div>' . "\n"; echo '<div id="page-results">' . "\n"; echo $this->draw_ga_table($this->page_results, 'page-results-table'); echo '<div id="source-jsenabled-div" class="jsenabled">' . "\n"; echo $this->draw_pager_div('page-results'); echo '</div>' . "\n"; echo '</div>' . "\n"; // page-results if ($this->has_events) { $events = $this->get_query_url_array($this->has_events, $this->event_results); echo '<div class="results-title"><h4>Events</h4></div>' . "\n"; echo '<div id="event-results">' . "\n"; if ($events) { echo $this->draw_query_url_table($events, 'event-results-table'); echo '<div id="source-jsenabled-div" class="jsenabled">' . "\n"; echo $this->draw_pager_div('event-results'); echo '</div>' . "\n"; } else { echo '<h5>There are no event results for this timeframe.</h5>' . "\n"; } echo '</div>' . "\n"; // event-results } if ($this->has_faq) { $faq = $this->get_query_url_array($this->has_faq, $this->faq_results); echo '<div class="results-title"><h4>FAQ</h4></div>' . "\n"; echo '<div id="faq-results">' . "\n"; if ($faq) { echo $this->draw_query_url_table($faq, 'faq-results-table'); echo '<div id="source-jsenabled-div" class="jsenabled">' . "\n"; echo $this->draw_pager_div('faq-results'); echo '</div>' . "\n"; } else { echo '<h5>There are no faq results for this timeframe.</h5>' . "\n"; } echo '</div>' . "\n"; // faq-results } if ($this->has_news) { $posts = $this->get_query_url_array($this->has_news, $this->news_results); echo '<div class="results-title"><h4>News / Posts</h4></div>' . "\n"; echo '<div id="news-results">' . "\n"; if ($posts) { echo $this->draw_query_url_table($posts, 'news-results-table'); echo '<div id="source-jsenabled-div" class="jsenabled">' . "\n"; echo $this->draw_pager_div('news-results'); echo '</div>' . "\n"; } else { echo '<h5>There are no news/post results for this timeframe.</h5>' . "\n"; } echo '</div>' . "\n"; // news-results } if ($this->has_policies) { $policies = $this->get_query_url_array($this->has_policies, $this->policy_results); echo '<div class="results-title"><h4>Policies</h4></div>' . "\n"; echo '<div id="policy-results">' . "\n"; if ($policies) { echo $this->draw_query_url_table($policies, 'policy-results-table'); echo '<div id="source-jsenabled-div" class="jsenabled">' . "\n"; echo $this->draw_pager_div('policy-results'); echo '</div>' . "\n"; } else { echo '<h5>There are no policy results for this timeframe.</h5>' . "\n"; } echo '</div>' . "\n"; // policy-results } } } else { echo '<div class="analytics-error">There are no results for this time frame.</div>'; } } } } echo '<div class="analytics-footer">' . "\n"; echo '<p>Please contact ' . REASON_CONTACT_INFO_FOR_ANALYTICS . ' for more detailed analytics.'; echo ' ' . '<a href="' . $this->admin_page->make_link(array('site_id' => $this->site->id(), 'cur_module' => 'AnalyticsAbout')) . '">About Analytics <img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/information.png" alt="" /></a></p>'; echo '</div>' . "\n"; //analytics-footer echo '</div>' . "\n"; //analytics-module }
/** * @return void */ function run() { echo '<div class="deleteSlotDataModule">' . "\n"; if (!user_can_edit_site($this->admin_page->user_id, id_of('master_admin'))) { echo '<p>You need to have master admin access to use this tool.</p>'; } elseif (empty($this->admin_page->site_id)) { echo '<p>You need to have a site selected to use this module.</p>'; } elseif (!$this->site_has_slot_type()) { echo '<p>This site doesn\'t have the registration slot type.</p>'; } elseif ($slots_with_data = $this->get_site_slots_with_data()) { $d = new Disco(); $d->add_element('comment', 'comment', array('text' => '<p>Registrant data will be erased from all checked slots immediately upon submit.</p>')); $d->add_element('slots_with_data', 'checkboxgroup', array('options' => $slots_with_data)); $d->add_callback(array($this, 'delete_slot_data_process'), 'process'); $d->add_callback(array($this, 'delete_slot_data_where_to'), 'where_to'); $d->actions = array('Delete registrant data from checked slots'); $d->set_value('slots_with_data', array_keys($slots_with_data)); $d->run(); } else { echo '<p>The site doesn\'t have any registration slots with registrant data to delete.</p>'; } echo '</div>' . "\n"; }
function run_policy_reviewed_date_form($policy) { $prettyDate = $this->prettifyEvenEmptyMysqlDatetime($policy->get_value("last_reviewed_date")); echo "<div class=\"reviewInfo\">\n"; echo "<a name=\"" . self::ANCHOR_LAST_REVIEWED . "\"></a>\n"; echo $this->createLastReviewedDateHeader($policy); /* echo "<p>" . (($prettyDate == self::UNSET_DATE) ? "This item does not have a last reviewed date." : "This item was last reviewed on $prettyDate") . ".</p>\n"; */ echo "<p>By clicking \"I Agree\", you affirm that you have reviewed this policy and that it is up-to-date. Clicking \"I Agree\" will set the policy's last reviewed date to " . date("M jS, Y") . ".</p>\n"; $this->edit_policy = $policy; $form = new Disco(); $form->set_box_class("StackedBox"); $form->actions = array(self::ACTION_CANCEL => 'Cancel', self::ACTION_MARK_POLICY_REVIEWED => 'I Agree'); if (THIS_IS_A_DEVELOPMENT_REASON_INSTANCE) { $form->actions[self::ACTION_DEBUG] = 'Set back to 0000-00-00 for testing purposes.'; } $form->add_callback(array(&$this, '_process_policy_reviewed_date'), 'process'); $form->add_callback(array(&$this, '_where_to_policy_reviewed_date'), 'where_to'); $form->run(); echo "</div>\n"; }