コード例 #1
0
 public function append_array($array)
 {
     if (isset($this->items_added)) {
         throw new Exception('You cannot append an array to a HTMLTags_FillTable more than once!');
     } else {
         $groups_array = $this->split_array($array);
         #print_r($groups_array);
         for ($i = 0; $i < count($groups_array); $i++) {
             $row = new HTMLTags_TR();
             for ($j = 0; $j < count($groups_array[$i]); $j++) {
                 $td = new HTMLTags_TD();
                 if (is_a($groups_array[$i][$j], 'HTMLTags_Tag')) {
                     #echo "tag\n";
                     $td->append_tag_to_content($groups_array[$i][$j]);
                 } else {
                     #echo "non-tag\n";
                     $td->append_str_to_content($groups_array[$i][$j]);
                 }
                 $row->append_tag_to_content($td);
             }
             $this->append_tag_to_content($row);
         }
         $this->items_added = TRUE;
     }
 }
コード例 #2
0
 public function get_admin_customers_html_table_tr($current_page_url)
 {
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     //        name notes');
     //            foreach ($field_names as $field_name) {
     //                $heading_row->append_sortable_field_name($field_name);
     //            }
     //
     //           $customer_region_header = new HTMLTags_TH('Currency');
     //            $heading_row->append_tag_to_content($customer_region_header);
     //           $address_header = new HTMLTags_TH('Address');
     //            $heading_row->append_tag_to_content($address_header);
     //           $email_address_header = new HTMLTags_TH('Email Address');
     //            $heading_row->append_tag_to_content($email_address_header);
     //           $telephone_header = new HTMLTags_TH('Telephone');
     //            $heading_row->append_tag_to_content($telephone_header);
     /*
      * The data.
      */
     $added_field = $table->get_field('added');
     $added_td = $this->get_data_html_table_td($added_field);
     $html_row->append_tag_to_content($added_td);
     $full_name_td = $this->get_full_name_td();
     $html_row->append_tag_to_content($full_name_td);
     $address_td = $this->get_address_td();
     $html_row->append_tag_to_content($address_td);
     $email_address_td = $this->get_email_address_td();
     $html_row->append_tag_to_content($email_address_td);
     $telephone_number_td = $this->get_telephone_number_td();
     $html_row->append_tag_to_content($telephone_number_td);
     $customer_region_td = $this->get_customer_region_td();
     $html_row->append_tag_to_content($customer_region_td);
     /*
      * The edit td.
      */
     $edit_td = new HTMLTags_TD();
     $edit_link = new HTMLTags_A('Edit');
     $edit_link->set_attribute_str('class', 'cool_button');
     $edit_link->set_attribute_str('id', 'edit_table_button');
     $edit_location = clone $current_page_url;
     $edit_location->set_get_variable('edit_id', $row->get_id());
     $edit_link->set_href($edit_location);
     $edit_td->append_tag_to_content($edit_link);
     $html_row->append_tag_to_content($edit_td);
     /*
      * The delete td.
      */
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     $delete_link->set_attribute_str('id', 'delete_table_button');
     $delete_location = clone $current_page_url;
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     $html_row->append_tag_to_content($delete_td);
     return $html_row;
 }
 public function get_product_id_with_link_td()
 {
     $td = new HTMLTags_TD();
     $product = $this->get_element();
     $link = new HTMLTags_A($product->get('product_id'));
     $url = Admin_AdminIncluderURLFactory::get_url('plug-ins', 'trackit-stock-management', 'product', 'html');
     $url->set_get_variable('product_id', $product->get_id());
     $link->set_href($url);
     $td->append_tag_to_content($link);
     return $td;
 }
コード例 #4
0
 private function get_admin_users_td($a_text, $admin_page)
 {
     $user_row = $this->get_element();
     $td = new HTMLTags_TD();
     $confirm_url = Admin_AdminIncluderURLFactory::get_url('haddock', 'admin', $admin_page, 'html');
     $confirm_url->set_get_variable('user_id', $user_row->get_id());
     $a = new HTMLTags_A($a_text);
     $a->set_href($confirm_url);
     $a->set_attribute_str('class', 'cool_button');
     $td->append_tag_to_content($a);
     return $td;
 }
コード例 #5
0
 public function get_admin_page_html_table_tr()
 {
     $page_row = $this->get_element();
     $admin_pages_html_table_tr = new HTMLTags_TR();
     $name_td = new HTMLTags_TD();
     $name_td->append_str_to_content($page_row->get_name());
     $admin_pages_html_table_tr->append_tag_to_content($name_td);
     $author_td = new HTMLTags_TD();
     $author_td->append_str_to_content($page_row->get_author());
     $admin_pages_html_table_tr->append_tag_to_content($author_td);
     $title_td = new HTMLTags_TD();
     #$title_td->append_str_to_content($page_row->get_title());
     $title_td->append_tag_to_content($this->get_title_a());
     $admin_pages_html_table_tr->append_tag_to_content($title_td);
     /*
      * The actions
      */
     $confirmation_url_base = new HTMLTags_URL();
     $confirmation_url_base->set_file('/');
     $confirmation_url_base->set_get_variable('section', 'haddock');
     $confirmation_url_base->set_get_variable('module', 'admin');
     $confirmation_url_base->set_get_variable('page', 'admin-includer');
     $confirmation_url_base->set_get_variable('type', 'html');
     $confirmation_url_base->set_get_variable('admin-section', 'haddock');
     $confirmation_url_base->set_get_variable('admin-module', 'database');
     /*
      * Edit the page's details.
      */
     $edit_td = new HTMLTags_TD();
     $edit_url = clone $confirmation_url_base;
     $edit_url->set_get_variable('admin-page', 'edit-page');
     $edit_url->set_get_variable('page_id', $page_row->get_id());
     $edit_a = new HTMLTags_A('Edit');
     $edit_a->set_href($edit_url);
     $edit_td->append_tag_to_content($edit_a);
     $admin_pages_html_table_tr->append_tag_to_content($edit_td);
     /*
      * Delete the page.
      */
     $delete_td = new HTMLTags_TD();
     $delete_url = clone $confirmation_url_base;
     $delete_url->set_get_variable('admin-page', 'delete-page');
     $delete_url->set_get_variable('page_id', $page_row->get_id());
     $delete_a = new HTMLTags_A('Delete');
     $delete_a->set_href($delete_url);
     $delete_td->append_tag_to_content($delete_a);
     $admin_pages_html_table_tr->append_tag_to_content($delete_td);
     return $admin_pages_html_table_tr;
 }
コード例 #6
0
 public function get_admin_currencies_html_table_tr($current_page_url)
 {
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     /*
      * The data.
      */
     $name_field = $table->get_field('name');
     $name_td = $this->get_data_html_table_td($name_field);
     $html_row->append_tag_to_content($name_td);
     $iso_4217_code_field = $table->get_field('iso_4217_code');
     $iso_4217_code_td = $this->get_data_html_table_td($iso_4217_code_field);
     $html_row->append_tag_to_content($iso_4217_code_td);
     $symbol_field = $table->get_field('symbol');
     $symbol_td = $this->get_data_html_table_td($symbol_field);
     $html_row->append_tag_to_content($symbol_td);
     /*
      * The edit td.
      */
     $edit_td = new HTMLTags_TD();
     $edit_link = new HTMLTags_A('Edit');
     $edit_link->set_attribute_str('class', 'cool_button');
     $edit_link->set_attribute_str('id', 'edit_table_button');
     $edit_location = clone $current_page_url;
     $edit_location->set_get_variable('edit_id', $row->get_id());
     $edit_link->set_href($edit_location);
     $edit_td->append_tag_to_content($edit_link);
     $html_row->append_tag_to_content($edit_td);
     /*
      * The delete td.
      */
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     $delete_link->set_attribute_str('id', 'delete_table_button');
     $delete_location = clone $current_page_url;
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     $html_row->append_tag_to_content($delete_td);
     return $html_row;
 }
コード例 #7
0
 private function get_shop_plug_in_action_td($location, $a_text, $a_id, $id_get_var_name)
 {
     $td = new HTMLTags_TD();
     $row = $this->get_element();
     $link = new HTMLTags_A($a_text);
     $link->set_attribute_str('class', 'cool_button');
     $link->set_attribute_str('id', $a_id);
     // horrible bug fix where it seems to be passing the same location
     // over and over again, with all previous get variables intact!
     if ($location->is_get_variable_set('edit_id')) {
         $location->unset_get_variable('edit_id');
     }
     if ($location->is_get_variable_set('delete_id')) {
         $location->unset_get_variable('delete_id');
     }
     $location->set_get_variable($id_get_var_name, $row->get_id());
     $link->set_href($location);
     $td->append_tag_to_content($link);
     return $td;
 }
コード例 #8
0
 public function get_data_html_table_td(Database_Field $field)
 {
     //echo "Entered Database_ImageRowRenderer::get_data_html_table_td(...)\n";
     #exit;
     if ($field->get_name() == 'image') {
         $field_renderer = $field->get_renderer();
         $img_tag = $this->get_img_in_public_images();
         //echo "Returned to Database_ImageRowRenderer::get_data_html_table_td(...)\n";
         #exit;
         $data_html_table_td = new HTMLTags_TD();
         $data_html_table_td->append_tag_to_content($img_tag);
         //echo 'print_r($data_html_table_td): ' . "\n";
         //print_r($data_html_table_td);
         //
         //echo "Returned to Database_ImageRowRenderer::get_data_html_table_td(...)\n";
         #exit;
         return $data_html_table_td;
     } else {
         return parent::get_data_html_table_td($field);
     }
 }
コード例 #9
0
                     $data_td = new HTMLTags_TD();
                     $data_td->append_str_to_content($supplier_shipping_price[0]->get_first_price() . '&nbsp;(' . $supplier_shipping_price[0]->get_additional_price() . ')');
                     $row_tr->append_tag_to_content($data_td);
                 } else {
                     $data_td = new HTMLTags_TD('not set');
                     $row_tr->append_tag_to_content($data_td);
                 }
             } catch (Exception $e) {
                 $data_td = new HTMLTags_TD('not set');
                 $row_tr->append_tag_to_content($data_td);
             }
         }
         /*
          * The edit td.
          */
         $edit_td = new HTMLTags_TD();
         $edit_link = new HTMLTags_A('Edit');
         $edit_link->set_attribute_str('class', 'cool_button');
         $edit_link->set_attribute_str('id', 'edit_table_button');
         $edit_location = clone $current_page_url;
         $edit_location->set_get_variable('edit_row', '1');
         $edit_location->set_get_variable('supplier_id', $supplier->get_id());
         $edit_location->set_get_variable('product_category_id', $product_category->get_id());
         $edit_link->set_href($edit_location);
         $edit_td->append_tag_to_content($edit_link);
         $row_tr->append_tag_to_content($edit_td);
         $supplier_table->append_tag_to_content($row_tr);
     }
     $content_div->append_tag_to_content($supplier_table);
 }
 # ------------------------------------------------------------------
コード例 #10
0
 public function get_product_td()
 {
     $shopping_basket = $this->get_element();
     $product = $shopping_basket->get_product();
     $photograph = $product->get_main_photograph();
     $photograph_renderer = $photograph->get_renderer();
     $product_td = new HTMLTags_TD();
     $product_td->append_tag_to_content($photograph_renderer->get_thumbnail_img());
     $product_td->append_str_to_content($product->get_name());
     return $product_td;
 }
コード例 #11
0
 private function get_td_with_id($content_str, $id_name)
 {
     $td = new HTMLTags_TD($content_str);
     $td->set_attribute_str('id', $id_name);
     return $td;
 }
コード例 #12
0
 public function get_suppliers_td()
 {
     $row = $this->get_element();
     $suppliers = $row->get_suppliers();
     $supplier_td = new HTMLTags_TD();
     foreach ($suppliers as $supplier) {
         $supplier_td->append_str_to_content($supplier->get_name());
         $supplier_td->append_tag_to_content(new HTMLTags_BR());
     }
     return $supplier_td;
 }
コード例 #13
0
 public function get_admin_database_tr_action_delete_td()
 {
     $row = $this->get_element();
     $table = $row->get_table();
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     #$delete_location = new HTMLTags_URL();
     #        $delete_location->set_file('/admin/index.php');
     #
     #        $delete_location->set_get_variable('module', 'database');
     #        $delete_location->set_get_variable('page', 'table');
     $delete_location = Admin_AdminIncluderURLFactory::get_url('haddock', 'database', 'table', 'html');
     $delete_location->set_get_variable('table', $table->get_name());
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     return $delete_td;
 }
コード例 #14
0
 public function get_admin_people_html_table_tr(HTMLTags_URL $edit_location, HTMLTags_URL $delete_location)
 {
     $person = $this->get_element();
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     $database = $row->get_database();
     /*
      * The data.
      */
     $added_field = $table->get_field('added');
     $added_td = $this->get_data_html_table_td($added_field);
     $html_row->append_tag_to_content($added_td);
     $name_field = $table->get_field('name');
     $name_td = $this->get_data_html_table_td($name_field);
     $html_row->append_tag_to_content($name_td);
     $email_field = $table->get_field('email');
     $email_td = $this->get_data_html_table_td($email_field);
     $html_row->append_tag_to_content($email_td);
     $status_field = $table->get_field('status');
     $status_td = $this->get_data_html_table_td($status_field);
     $html_row->append_tag_to_content($status_td);
     /*
      * The edit td.
      */
     $edit_td = new HTMLTags_TD();
     $edit_link = new HTMLTags_A('Edit');
     $edit_link->set_attribute_str('class', 'cool_button');
     $edit_link->set_attribute_str('id', 'edit_table_button');
     #            $edit_location = new HTMLTags_URL();
     #
     #            $edit_location->set_file('/admin/');
     #
     #            $edit_location->set_get_variable('module', 'mailing-list');
     #            $edit_location->set_get_variable('page', 'mailing-list');
     $edit_location->set_get_variable('edit_id', $row->get_id());
     $edit_link->set_href($edit_location);
     $edit_td->append_tag_to_content($edit_link);
     $html_row->append_tag_to_content($edit_td);
     /*
      * The delete td.
      */
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     $delete_link->set_attribute_str('id', 'delete_table_button');
     #            $delete_location = new HTMLTags_URL();
     #
     #            $delete_location->set_file('/admin/');
     #
     #            $delete_location->set_get_variable('module', 'mailing-list');
     #            $delete_location->set_get_variable('page', 'mailing-list');
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     $html_row->append_tag_to_content($delete_td);
     return $html_row;
 }
コード例 #15
0
 public function get_tags_td()
 {
     $tags_td = new HTMLTags_TD();
     $tags_str = $this->get_tags_as_csv();
     #print_r($tags_str);
     $tags_td->append_str_to_content($tags_str);
     return $tags_td;
 }
コード例 #16
0
 public function append_row_action_tds_to_tr(Database_Row $row, HTMLTags_TR $dtr)
 {
     $row_renderer = $row->get_renderer();
     $dn = $this->get_display_node();
     $ases = $dn->getElementsByTagName('actions');
     if ($ases->length == 1) {
         $ase = $ases->item(0);
         $aes = $ase->getElementsByTagName('action');
         for ($i = 0; $i < $aes->length; $i++) {
             $ae = $aes->item($i);
             if ($ae->getAttribute('name') == 'edit' || $ae->getAttribute('name') == 'delete') {
                 $td = new HTMLTags_TD();
                 if ($ae->getAttribute('name') == 'edit') {
                     if ($ae->hasAttribute('edit_link_text')) {
                         $link = new HTMLTags_A($this->getAttribute('edit_link_text'));
                     } else {
                         $link = new HTMLTags_A('Edit');
                     }
                 } elseif ($ae->getAttribute('name') == 'delete') {
                     if ($ae->hasAttribute('delete_link_text')) {
                         $link = new HTMLTags_A($this->getAttribute('delete_link_text'));
                     } else {
                         $link = new HTMLTags_A('Delete');
                     }
                 }
                 $link->set_attribute_str('class', 'cool_button');
                 $location = $this->get_html_location();
                 if ($ae->getAttribute('name') == 'edit') {
                     $location->set_get_variable('edit_id', $row->get_id());
                 } elseif ($ae->getAttribute('name') == 'delete') {
                     $location->set_get_variable('delete_id', $row->get_id());
                 }
                 $link->set_href($location);
                 $td->append_tag_to_content($link);
             } else {
                 if ($ae->hasAttribute('td_render_method_name')) {
                     $rmn = $ae->getAttribute('td_render_method_name');
                     $rrro = new ReflectionObject($row_renderer);
                     $rm = $rrro->getMethod($rmn);
                     $td = $rm->invoke($row_renderer);
                 } else {
                     throw new Exception('No action TD render method set!');
                 }
             }
             $dtr->append_tag_to_content($td);
         }
         return $dtr;
     }
     throw new Exception('Unable to append actions to data TR!');
 }
コード例 #17
0
 public function get_short_address_td()
 {
     $address = $this->get_element();
     $address_td = new HTMLTags_TD($address_text);
     $address_td->set_attribute_str('style', 'text-align: left');
     if ($address->has_post_office_box()) {
         $address_td->append_str_to_content($address->get_post_office_box());
         $address_td->append_tag_to_content(new HTMLTags_BR());
     }
     if ($address->has_extended_address()) {
         $address_td->append_str_to_content($address->get_extended_address());
         $address_td->append_tag_to_content(new HTMLTags_BR());
     }
     $address_td->append_str_to_content($address->get_street_address());
     $address_td->append_tag_to_content(new HTMLTags_BR());
     $address_td->append_str_to_content($address->get_locality());
     $address_td->append_tag_to_content(new HTMLTags_BR());
     $address_td->append_str_to_content($address->get_region());
     $address_td->append_tag_to_content(new HTMLTags_BR());
     $address_td->append_str_to_content($address->get_postal_code());
     $address_td->append_tag_to_content(new HTMLTags_BR());
     $address_td->append_str_to_content($address->get_country_name());
     return $address_td;
 }
コード例 #18
0
 public function get_thumbnail_image_td()
 {
     $thumbnail_image_td = new HTMLTags_TD();
     $row = $this->get_element();
     $thumbnail_image_row = $row->get_thumbnail_image_row();
     #print_r($thumbnail_image_row);
     $thumbnail_image_row_renderer = $thumbnail_image_row->get_renderer();
     #print_r($thumbnail_image_row_renderer);
     $img_tag = $thumbnail_image_row_renderer->get_img_in_public_images();
     //$database = $row->get_database();
     //
     //$images_table = $database->get_table('hc_database_images');
     //
     //$images_field = $images_table->get_field('image');
     //
     //return
     //    $thumbnail_image_row_renderer
     //        ->get_data_html_table_td_with_image($images_field);
     $full_a = new HTMLTags_A();
     $full_size_image = $row->get_full_size_image();
     #print_r($full_size_image);
     $full_size_image_renderer = $full_size_image->get_renderer();
     $full_size_image_url = $full_size_image_renderer->get_html_url_in_public_images();
     $full_a->set_href($full_size_image_url);
     $full_a->append_tag_to_content($img_tag);
     $thumbnail_image_td->append_tag_to_content($full_a);
     return $thumbnail_image_td;
 }
コード例 #19
0
 public function get_product_td()
 {
     $comment = $this->get_element();
     $product = $comment->get_product();
     $product_td = new HTMLTags_TD();
     $product_td->append_str_to_content($product->get_name());
     return $product_td;
 }
コード例 #20
0
    $u_t_tr->append_tag_to_content(new HTMLTags_TD($count_passed_tests));
    $count_test_functions = $u_t_p_c_f->count_test_functions();
    $total_tests += $count_test_functions;
    $u_t_tr->append_tag_to_content(new HTMLTags_TD($count_test_functions));
    $passes_all_tests = $u_t_p_c_f->passes_all_tests();
    if ($everything_passes && !$passes_all_tests) {
        $everything_passes = FALSE;
    }
    $result_td = new HTMLTags_TD($passes_all_tests ? 'Pass' : 'Fail');
    $result_td->set_attribute_str('class', $passes_all_tests ? 'pass' : 'fail');
    $u_t_tr->append_tag_to_content($result_td);
    $total_test_time = $u_t_p_c_f->get_total_test_time();
    $total_time_all_tests += $total_test_time;
    $u_t_tr->append_tag_to_content(new HTMLTags_TD(sprintf('%.5f', $total_test_time)));
    $unit_tests_html_table->append_tag_to_content($u_t_tr);
}
$summary_tr = new HTMLTags_TR();
$summary_tr->set_attribute_str('class', 'summary');
$summary_tr->append_tag_to_content(new HTMLTags_TD('Summary'));
$summary_tr->append_tag_to_content(new HTMLTags_TD($total_passes));
$summary_tr->append_tag_to_content(new HTMLTags_TD($total_tests));
$result_td = new HTMLTags_TD($everything_passes ? 'Pass' : 'Fail');
$result_td->set_attribute_str('class', $everything_passes ? 'pass' : 'fail');
$summary_tr->append_tag_to_content($result_td);
$summary_tr->append_tag_to_content(new HTMLTags_TD(sprintf('%.5f', $total_time_all_tests)));
$unit_tests_html_table->append_tag_to_content($summary_tr);
$content_div->append_tag_to_content($unit_tests_html_table);
/*
 * -----------------------------------------------------------------------------
 */
echo $content_div->get_as_string();
 public function get_admin_product_currency_prices_html_table_tr()
 {
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     //        name notes');
     //            foreach ($field_names as $field_name) {
     //                $heading_row->append_sortable_field_name($field_name);
     //            }
     //
     //           $currency_header = new HTMLTags_TH('Currency');
     //            $heading_row->append_tag_to_content($currency_header);
     //           $address_header = new HTMLTags_TH('Address');
     //            $heading_row->append_tag_to_content($address_header);
     //           $email_address_header = new HTMLTags_TH('Email Address');
     //            $heading_row->append_tag_to_content($email_address_header);
     //           $telephone_header = new HTMLTags_TH('Telephone');
     //            $heading_row->append_tag_to_content($telephone_header);
     /*
      * The data.
      */
     $name_field = $table->get_field('name');
     $name_td = $this->get_data_html_table_td($name_field);
     $html_row->append_tag_to_content($name_td);
     $notes_field = $table->get_field('notes');
     $notes_td = $this->get_data_html_table_td($notes_field);
     $html_row->append_tag_to_content($notes_td);
     $currency_td = $this->get_currency_td();
     $html_row->append_tag_to_content($currency_td);
     $address_td = $this->get_address_td();
     $html_row->append_tag_to_content($address_td);
     $email_address_td = $this->get_email_address_td();
     $html_row->append_tag_to_content($email_address_td);
     $telephone_number_td = $this->get_telephone_number_td();
     $html_row->append_tag_to_content($telephone_number_td);
     /*
      * The edit td.
      */
     $edit_td = new HTMLTags_TD();
     $edit_link = new HTMLTags_A('Edit');
     $edit_link->set_attribute_str('class', 'cool_button');
     $edit_link->set_attribute_str('id', 'edit_table_button');
     $edit_location = new HTMLTags_URL();
     $edit_location->set_file('/admin/');
     $edit_location->set_get_variable('module', 'shop');
     $edit_location->set_get_variable('page', 'product_currency_prices');
     $edit_location->set_get_variable('edit_id', $row->get_id());
     $edit_link->set_href($edit_location);
     $edit_td->append_tag_to_content($edit_link);
     $html_row->append_tag_to_content($edit_td);
     /*
      * The delete td.
      */
     $delete_td = new HTMLTags_TD();
     $delete_link = new HTMLTags_A('Delete');
     $delete_link->set_attribute_str('class', 'cool_button');
     $delete_link->set_attribute_str('id', 'delete_table_button');
     $delete_location = new HTMLTags_URL();
     $delete_location->set_file('/admin/');
     $delete_location->set_get_variable('module', 'shop');
     $delete_location->set_get_variable('page', 'product_currency_prices');
     $delete_location->set_get_variable('delete_id', $row->get_id());
     $delete_link->set_href($delete_location);
     $delete_td->append_tag_to_content($delete_link);
     $html_row->append_tag_to_content($delete_td);
     return $html_row;
 }
コード例 #22
0
 public function get_admin_product_tags_html_table_tr($redirect_script_url)
 {
     $html_row = new HTMLTags_TR();
     $row = $this->get_element();
     $table = $row->get_table();
     /*
      * The data.
      */
     $tag_field = $table->get_field('tag');
     $tag_td = $this->get_data_html_table_td($tag_field);
     $html_row->append_tag_to_content($tag_td);
     $principal_field = $table->get_field('principal');
     $principal_td = $this->get_data_html_table_td($principal_field);
     $html_row->append_tag_to_content($principal_td);
     $no_of_products_td = $this->get_no_of_products_td();
     $html_row->append_tag_to_content($no_of_products_td);
     /*
      * The toggle_principal_status td.
      */
     $product_tag = $this->get_element();
     if ($product_tag->is_principal()) {
         $toggle_principal_status_link = new HTMLTags_A('Make Normal');
     } else {
         $toggle_principal_status_link = new HTMLTags_A('Make Principal');
     }
     $toggle_principal_status_td = new HTMLTags_TD();
     $toggle_principal_status_link->set_attribute_str('class', 'cool_button');
     $toggle_principal_status_link->set_attribute_str('id', 'toggle_principal_status_table_button');
     $toggle_principal_status_location = clone $redirect_script_url;
     $toggle_principal_status_location->set_get_variable('toggle_principal_status');
     $toggle_principal_status_location->set_get_variable('product_tag_id', $row->get_id());
     $toggle_principal_status_link->set_href($toggle_principal_status_location);
     $toggle_principal_status_td->append_tag_to_content($toggle_principal_status_link);
     $html_row->append_tag_to_content($toggle_principal_status_td);
     return $html_row;
 }
 protected function get_option_trs()
 {
     $option_trs = array();
     foreach ($this->actors as $actor) {
         if ($actor->has_options()) {
             // Actors Name TR
             $actors_name_tr = new HTMLTags_TR();
             $actors_name_em = new HTMLTags_Em($actor->get_name());
             $actors_name_th = new HTMLTags_TH();
             $actors_name_th->append_tag_to_content($actors_name_em);
             $actors_name_th->set_attribute_str('class', 'option');
             $actors_name_th->set_attribute_str('id', $actor->get_color());
             $actors_name_tr->append_tag_to_content($actors_name_th);
             for ($i = -1; $i < count($this->actors); $i++) {
                 $blank_td = new HTMLTags_TD();
                 $actors_name_tr->append_tag_to_content($blank_td);
             }
             $option_trs[] = $actors_name_tr;
             // Option TRs with positions
             $options = $actor->get_options();
             foreach ($options as $option) {
                 $tr = new HTMLTags_TR();
                 $option_th = new HTMLTags_TH($option->get_name());
                 $option_th->set_attribute_str('class', 'option');
                 $option_th->set_attribute_str('id', $actor->get_color());
                 $tr->append_tag_to_content($option_th);
                 foreach ($this->actors as $position_actor) {
                     $position = $option->get_position($position_actor->get_id());
                     $position_td = new HTMLTags_TD();
                     $position_td->append_tag_to_content($this->get_position_tile($position));
                     $tr->append_tag_to_content($position_td);
                 }
                 // Stated Intention TD
                 $stated_intention = $option->get_stated_intention();
                 $stated_intention_td = new HTMLTags_TD();
                 $stated_intention_td->append_tag_to_content($this->get_stated_intention_tile($stated_intention, $actor));
                 $tr->append_tag_to_content($stated_intention_td);
                 $option_trs[] = $tr;
             }
             // Blank TR
             $blank_tr = new HTMLTags_TR();
             $blank_th = new HTMLTags_TH();
             $blank_th->set_attribute_str('class', 'blank');
             $blank_tr->append_tag_to_content($blank_th);
             for ($i = -1; $i < count($this->actors); $i++) {
                 $blank_td = new HTMLTags_TD();
                 $blank_tr->append_tag_to_content($blank_td);
             }
             $option_trs[] = $blank_tr;
         }
     }
     return $option_trs;
 }
コード例 #24
0
 public function get_editable_quantity_td()
 {
     $editable_quantity_td = new HTMLTags_TD();
     $order_row = $this->get_element();
     $orders_table = $order_row->get_table();
     $order_editing_action = new HTMLTags_URL();
     $order_editing_action->set_file('/');
     $order_editing_action->set_get_variable('page', 'shopping-basket');
     $order_editing_action->set_get_variable('type', 'redirect-script');
     $order_editing_action->set_get_variable('edit_order_id', $order_row->get_id());
     $cancel_location = new HTMLTags_URL();
     $cancel_location->set_file('/shopping-basket.html');
     $order_editing_form = new HTMLTags_SimpleOLForm('order_editing');
     $order_editing_form->set_action($order_editing_action);
     $order_editing_form->set_legend_text('Edit the amount');
     /*
      * The quantity
      */
     $quantity_field = $orders_table->get_field('quantity');
     $quantity_field_renderer = $quantity_field->get_renderer();
     $input_tag = $quantity_field_renderer->get_form_input();
     $input_tag->set_value($order_row->get_quantity());
     $input_tag->set_attribute_str('id', 'quantity');
     $order_editing_form->add_input_tag('quantity', $input_tag);
     /*
      * The update button.
      */
     $order_editing_form->set_submit_text('Update');
     $order_editing_form->set_cancel_location($cancel_location);
     $editable_quantity_td->append_tag_to_content($order_editing_form);
     return $editable_quantity_td;
 }
コード例 #25
0
 protected function get_data_trs()
 {
     $data_trs = array();
     $key_fields = $this->get_key_fields();
     $base_redirect_script_url = $this->get_base_redirect_script_url();
     foreach ($this->row_data as $row_datum) {
         echo 'print_r($row_datum):' . "\n";
         print_r($row_datum);
         $data_tr = new HTMLTags_TR();
         /*
          * Make TDs for the row datum elements.
          */
         foreach ($row_datum as $rde) {
             $td = new HTMLTags_TD($rde);
             $data_tr->append_tag_to_content($td);
         }
         /*
          * Make TDs for links to the redirect script to move the row up or down.
          */
         $current_data_row_brsu = clone $base_redirect_script_url;
         foreach ($key_fields as $key_field) {
             $current_data_row_brsu->set_get_variable($key_field, $row_datum[$key_field]);
         }
         foreach (explode(' ', 'up down') as $direction) {
             $td = new HTMLTags_TD();
             /*
              * Make the link text.
              */
             $link_text = 'Shift' . ucfirst($direction);
             $current_shirt_direction_rsu = clone $current_data_row_brsu;
             $current_shirt_direction_rsu->set_get_variable('direction', $direction);
             $shift_a = new HTMLTags_A($link_text);
             $shift_a->set_href($current_shirt_direction_rsu);
             $td->append_tag_to_content($shift_a);
             $data_tr->append_tag_to_content($td);
         }
         $data_trs[] = $data_tr;
     }
     return $data_trs;
 }