Пример #1
0
 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";
 }
Пример #2
0
 /**
  * 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";
 }
 /**
  * Return the basic form.
  */
 function get_runner_form($type)
 {
     if ($type == 'run' || $type == 'run_all' || $type == 'continue') {
         $rf = new Disco();
         if ($type == 'run_all') {
             $submit_button_text = 'Run Module(s)';
         } elseif ($type == 'run') {
             $submit_button_text = 'Run Module';
         } elseif ($type == 'continue') {
             $submit_button_text = 'Continue Upgrade';
             $rf->add_element('not_complete', 'comment', array('text' => '<strong>This upgrade is not yet complete.</strong>'));
         }
         $rf->add_element('mode', 'hidden');
         $rf->set_value('mode', 'run');
         $rf->set_actions(array($submit_button_text));
         return $rf;
     } else {
         trigger_error('The runner form type must be run, test, run_all, or continue');
     }
 }
 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 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();
 }
Пример #6
0
 /**
  * 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 '&nbsp;&nbsp;&nbsp;' . '<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";
 }
Пример #8
0
 protected function _get_form()
 {
     $d = new Disco();
     $d->set_form_class("StackedBox");
     $d->add_element('name', 'text');
     $d->set_display_name('name', 'Creator\'s Name');
     $d->add_required('name');
     $d->add_element('email', 'text');
     $d->set_display_name('email', 'Creator\'s Email Address');
     $d->add_required('email');
     $d->add_element('class_year', 'text');
     $d->set_display_name('class_year', 'Creators\'s Class Year (if Applicable)');
     $d->add_element('media_title', 'text');
     $d->set_display_name('media_title', 'Title');
     $d->add_required('media_title');
     $d->add_element('description', 'textarea');
     $d->set_display_name('description', 'Media Description');
     $d->add_required('description');
     $av_types = $this->shim->get_supported_av_types();
     if (count($av_types) == 1) {
         $d->add_element('av_type', 'hidden');
         $d->set_value('av_type', current($av_types));
     } else {
         $audio_blurb = 'Audio <span class="smallText formComment">(e.g. sound-only music, speech, etc.)</span>';
         $video_blurb = 'Video <span class="smallText formComment">(e.g. movies, videos, etc.)</span>';
         $d->add_element('av_type', 'radio_no_sort', array('options' => array('Audio' => $audio_blurb, 'Video' => $video_blurb)));
     }
     $d->set_display_name('av_type', 'Media Type');
     $d->add_required('av_type');
     //$authenticator = array("reason_username_has_access_to_site", $this->get_value("site_id"));
     $params = array('acceptable_extensions' => $this->shim->get_recognized_extensions(), 'max_file_size' => $this->_get_actual_max_upload_size(), 'head_items' => &$this->head_items);
     $d->add_element('upload_file', 'ReasonUpload', $params);
     $d->set_display_name('upload_file', 'Media to Upload');
     //$d->add_required('upload_file');
     $d->add_comments('upload_file', form_comment('If the file is on your computer, browse to it here.'));
     $d->add_comments('upload_file', form_comment('File must have one of the following extensions: .' . implode(', .', $this->shim->get_recognized_extensions())));
     $d->add_comments('upload_file', form_comment('<div class="maxUploadSizeNotice">Maximum file size for uploading is ' . MEDIA_MAX_UPLOAD_FILESIZE_MEGS . 'MB. </div>'));
     $d->add_element('url', 'text');
     $d->set_display_name('url', 'Media url');
     $d->add_comments('url', form_comment('If you are uploading a file larger than ' . MEDIA_MAX_UPLOAD_FILESIZE_MEGS . 'MB, enter the url of the file you are uploading here.'));
     $d->add_comments('url', form_comment('Example: http://people.carleton.edu/~[USERNAME]/reason_import_only/[FILENAME]'));
     $d->add_element('permission', 'checkboxfirst');
     $d->set_display_name('permission', 'I give Carleton College the right to reproduce, display, and use this media in any manner.');
     $d->add_required('permission');
     $d->add_element('rights', 'checkboxfirst');
     $d->set_display_name('rights', 'I am the creator of this media and have full rights to its use.');
     $d->add_required('rights');
     $d->set_actions(array('save' => 'Submit your Media'));
     $d->form_enctype = 'multipart/form-data';
     $this->_populate_author($d);
     $d->add_callback(array($this, 'get_intro'), 'pre_show_form');
     $d->add_callback(array($this, 'error_check_form'), 'run_error_checks');
     $d->add_callback(array($this, 'process_form'), 'process');
     $d->add_callback(array($this, 'get_thank_you_url'), 'where_to');
     return $d;
 }