/** * Lays out a row for the subsection * @param EE_Form_Section_Proper $form_section * @return string */ public function layout_subsection($form_section) { $html = ''; if ($form_section instanceof EE_Form_Section_HTML) { $html .= $form_section->get_html_and_js(); } else { $html .= EEH_HTML::tr(EEH_HTML::td($form_section->get_html_and_js(), '', '', '', 'colspan="2"')); } return $html; }
/** * _item_row * * @param EE_Line_Item $line_item * @param array $options * @return mixed */ protected function _item_row(EE_Line_Item $line_item, $options = array()) { $line_item_related_object = $line_item->get_object(); $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null; // start of row $row_class = $options['odd'] ? 'item odd' : 'item'; $html = EEH_HTML::tr('', '', $row_class); //Name Column $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : ''; //related object scope. $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : ''; $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : ''; $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name(); $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; $name_html .= $line_item->is_taxable() ? ' *' : ''; //maybe preface with icon? $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html; $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; $name_html .= sprintf(_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), '<span class="ee-line-item-related-parent-object">', $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type() : __('Item:', 'event_espresso'), $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name, '</span>'); $html .= EEH_HTML::td($name_html, '', 'jst-left'); //Type Column $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type() . '<br />' : ''; $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; $type_html .= !empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; $html .= EEH_HTML::td($type_html, '', 'jst-left'); //Date column $datetime_content = ''; if ($line_item_related_object instanceof EE_Ticket) { $datetimes = $line_item_related_object->datetimes(); foreach ($datetimes as $datetime) { if ($datetime instanceof EE_Datetime) { $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; } } } $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); //Amount Column if ($line_item->is_percent()) { $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); } else { $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); } //finish things off and return $html .= EEH_HTML::trx(); return $html; }
/** * Lays out the row for the input, including label and errors * @param EE_Form_Input_Base $input * @return string */ public function layout_input($input) { if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy) { $input->set_html_class($input->html_class() . ' large-text'); } if ($input instanceof EE_Text_Area_Input) { $input->set_rows(4); $input->set_cols(60); } $input_html = $input->get_html_for_input(); // maybe add errors and help text ? $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; //overriding parent to add wp admin specific things. $html = ''; if ($input instanceof EE_Hidden_Input) { $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); } else { $html .= EEH_HTML::tr(EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"') . EEH_HTML::td($input_html)); } return $html; }
/** * _separator_row * * @param array $options * @return mixed */ private function _separator_row($options = array()) { // colspan $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; // start of row $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); // // separator td // $html .= EEH_HTML::td( '<hr>', '', '', '', $colspan ); // // end of row // $html .= EEH_HTML::trx(); return $html; }
/** * _fine_print * * @access protected * @return \EE_Form_Section_HTML */ protected function _fine_print() { return new EE_Form_Section_HTML(EEH_HTML::tr(EEH_HTML::th() . EEH_HTML::td(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')))); }
/** * _payments_and_amount_owing_rows * * @param EE_Line_Item $line_item * @param array $options * @return mixed */ private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { $html = ''; $owing = $line_item->total(); $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); if ($transaction instanceof EE_Transaction) { $registration_payments = array(); $registrations = !empty($options['registrations']) ? $options['registrations'] : $transaction->registrations(); foreach ($registrations as $registration) { if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { $registration_payments = $registration_payments + $registration->registration_payments(); } } if (!empty($registration_payments)) { foreach ($registration_payments as $registration_payment) { if ($registration_payment instanceof EE_Registration_Payment) { $owing = $owing - $registration_payment->amount(); $payment = $registration_payment->payment(); if ($payment instanceof EE_Payment) { $payment_desc = sprintf(__('Payment%1$s Received: %2$s', 'event_espresso'), $payment->txn_id_chq_nmbr() != '' ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' : '', $payment->timestamp()); } else { $payment_desc = ''; } // start of row $html .= EEH_HTML::tr('', '', 'total_tr odd'); // payment desc $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); // total td $html .= EEH_HTML::td(EEH_Template::format_currency($registration_payment->amount(), false, false), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); } } if ($line_item->total()) { // start of row $html .= EEH_HTML::tr('', '', 'total_tr odd'); // total td $html .= EEH_HTML::td(__('Amount Owing', 'event_espresso'), '', 'total_currency total jst-rght', '', ' colspan="3"'); // total td $html .= EEH_HTML::td(EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); } } } $this->_grand_total = $owing; return $html; }
/** * _sub_item_row * * @param EE_Line_Item $line_item * @param array $options * @return mixed */ private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { // start of row $html = EEH_HTML::tr('', 'item sub-item-row'); // name && desc $name_and_desc = $line_item->name(); $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; // name td $html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item'); // discount/surcharge td if ($line_item->is_percent()) { $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); } else { $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); } // total td $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); // end of row $html .= EEH_HTML::trx(); return $html; }
/** * _total_row * * @param EE_Line_Item $line_item * @param string $text * @param bool $tax_total * @return mixed */ private function _total_row(EE_Line_Item $line_item, $text = '', $tax_total = false) { if ($tax_total && $this->_tax_count < 2) { return ''; } //EE_Registry::instance()->load_helper('Money'); //if ( ) // start of row $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); // total td $html .= EEH_HTML::td(EEH_HTML::strong(EED_Multi_Event_Registration::$event_cart_name . ' ' . $line_item->desc() . ' ' . $text), '', 'total_currency total jst-rght', '', ' colspan="2"'); // total qty $total_qty = $tax_total ? '' : EE_Registry::instance()->CART->all_ticket_quantity_count(); $html .= EEH_HTML::td(EEH_HTML::strong($total_qty), '', 'mini-cart-tbl-qty-td total jst-cntr'); // total td $html .= EEH_HTML::td(EEH_HTML::strong($line_item->total_no_code()), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); return $html; }
/** * _total_row * * @param EE_Line_Item $line_item * @param string $text * @param int $total_items * @return mixed */ private function _total_row(EE_Line_Item $line_item, $text = '', $total_items = 0) { //EE_Registry::instance()->load_helper('Money'); // start of row $html = EEH_HTML::tr('', 'event-cart-total-row-' . $line_item->ID(), 'event-cart-total-row-' . $line_item->type() . ' event-cart-total-row total_tr'); // total td $html .= EEH_HTML::td(EEH_HTML::strong($text), '', 'total_currency total jst-rght', '', ' colspan="2"'); // total qty $total_items = $total_items ? $total_items : ''; $html .= EEH_HTML::td(EEH_HTML::strong('<span class="total">' . $total_items . '</span>'), '', 'total jst-cntr'); // total td $html .= EEH_HTML::td(EEH_HTML::strong($line_item->total_no_code()), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); return $html; }
/** * _separator_row * * @param array $options * @return mixed */ private function _separator_row($options = array()) { // start of row $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', ' colspan="4"')); return $html; }
/** * no_row - for generating a "hidden" table row, good for embedding tables within tables * generates a new table row with one td cell that spans however many columns you set * removes all styles from the tr and td * * @param string $content * @param int $colspan * @return string */ public static function no_row($content = '', $colspan = 2) { return EEH_HTML::tr(EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="' . $colspan . '"'), '', '', 'padding:0; border:none;'); }
/** * _payments_and_amount_owing_rows * * @param EE_Line_Item $line_item * @return mixed */ private function _payments_and_amount_owing_rows(EE_Line_Item $line_item) { $html = ''; $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); if ($transaction instanceof EE_Transaction) { $payments = $transaction->approved_payments(); if (!empty($payments)) { foreach ($payments as $payment) { if ($payment instanceof EE_Payment) { //$owing = $owing - $payment->amount(); $payment_desc = sprintf(__('Payment%1$s Received: %2$s', 'event_espresso'), $payment->txn_id_chq_nmbr() != '' ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' : '', $payment->timestamp()); // start of row $html .= EEH_HTML::tr('', '', 'total_tr odd'); // payment desc $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); // total td $html .= EEH_HTML::td(EEH_Template::format_currency($payment->amount(), false, false), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); } } //if ( $line_item->total() ) { // // start of row // $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); // // total td // $html .= EEH_HTML::td( __('Amount Owing', 'event_espresso'), '', 'total_currency total jst-rght', '', ' colspan="3"' ); // // total td // $html .= EEH_HTML::td( EEH_Template::format_currency( $this->grand_total(), false, false ), '', 'total jst-rght' ); // // end of row // $html .= EEH_HTML::trx(); //} } } return $html; }