Пример #1
0
 /**
  * @return WpTesting_Widget_PassingTable
  */
 protected function createPassingTableOnce()
 {
     if (!is_null($this->passingTable)) {
         return $this->passingTable;
     }
     $this->passingTable = new $this->passingTableClass(array('wp' => $this->wp, 'screen' => $this->screenHook));
     $this->passingTable->set_records_per_page($this->getCurrentUserMeta('passing_browser_per_page'))->set_order_by($this->getRequestValue('orderby'), $this->getRequestValue('order'));
     $this->wp->doAction('wp_testing_passing_browser_create_table', $this->passingTable);
     return $this->passingTable;
 }
Пример #2
0
 /**
  * @param WpTesting_Model_Passing $item
  * @param string $column_name
  * @return string
  */
 protected function render_static_column(WpTesting_Model_Passing $item, $column_name)
 {
     switch ($column_name) {
         case 'row_number':
             return $this->get_row_number();
         case 'test_title':
             $test = $item->createTest();
             return $this->render_link($this->wp->getPostPermalink($test->getId()), $test->getTitle());
         case 'results':
             $links = array();
             /* @var $result WpTesting_Model_Result */
             foreach ($item->buildResults() as $result) {
                 $links[] = $result->getTitle();
             }
             return implode(', ', $links);
         case 'scales':
             $links = array();
             foreach ($item->buildScalesWithRangeOnce() as $scale) {
                 $link = $scale->getTitle();
                 $outOf = ' (' . sprintf(__('%1$d out of %2$d', 'wp-testing'), $scale->getValue(), $scale->getMaximum()) . ')';
                 $links[] = $link . str_replace(' ', ' ', $outOf);
             }
             return implode(', ', $links);
         case 'view':
             return $this->render_link($item->getUrl());
     }
     return parent::render_static_column($item, $column_name);
 }
Пример #3
0
 protected function render_filter_controls()
 {
     $labels = $this->get_static_columns();
     $currentStatus = fRequest::get('passing_status');
     if ($currentStatus) {
         $currentStatus = $this->render_hidden('passing_status', $currentStatus);
     } else {
         $currentStatus = '';
     }
     return implode(PHP_EOL, array($currentStatus)) . parent::render_filter_controls() . implode(PHP_EOL, array($this->render_search_input('filter_condition[user]', $labels['user']), $this->render_search_input('filter_condition[passing_device_uuid]', $labels['passing_device_uuid']), $this->render_search_input('filter_condition[passing_ip]', $labels['passing_ip']), $this->render_search_input('filter_condition[passing_user_agent]', $labels['passing_user_agent'])));
 }