public function append_nonsortable_field_name($field_name)
 {
     $th = new HTMLTags_TH();
     $f_n_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($field_name, '_');
     $th->append_str_to_content($f_n_l_o_ws->get_words_as_capitalised_string());
     $this->append_tag_to_content($th);
 }
 public function get_input_lis()
 {
     $input_lis = array();
     $visible_fields = $this->get_visible_fields();
     $row_renderer = $this->row->get_renderer();
     foreach ($visible_fields as $visible_field) {
         $input_li = new HTMLTags_LI();
         $l_t_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($visible_field->get_name(), '_');
         $label_text = $l_t_l_o_ws->get_words_as_capitalised_string();
         $input_label = new HTMLTags_Label($label_text);
         $input_label->set_attribute_str('for', $visible_field->get_name());
         #$input_label->set_attribute_str('id', $name);
         $input_li->append_tag_to_content($input_label);
         #$field_renderer = $visible_field->get_renderer();
         #
         #$input_tag = $field_renderer->get_form_input();
         #
         #echo '$visible_field->get_name(): ' . $visible_field->get_name() . "\n";
         #
         #$input_tag->set_value(
         #    $this->row->get($visible_field->get_name())
         #);
         $input_tag = $row_renderer->get_input_tag_for_field($visible_field);
         $input_li->append_tag_to_content($input_tag);
         $input_lis[] = $input_li;
     }
     return $input_lis;
 }
 public function add_input_tag($name, HTMLTags_InputTag $input_tag, $label_text = null, $post_content = '')
 {
     #echo "In HTMLTags_SimpleOLForm::add_input_tag(...)\n";
     $input_li = new HTMLTags_LI();
     if (!isset($label_text)) {
         $l_t_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($name, '_');
         $label_text = $l_t_l_o_ws->get_words_as_capitalised_string();
         #    echo "\$label_text: $label_text\n";
         #} else {
         #    echo "\$label_text: $label_text\n";
     }
     #echo "After if\n";
     $input_label = new HTMLTags_Label($label_text);
     $input_label->set_attribute_str('for', $name);
     #$input_label->set_attribute_str('id', $name);
     $input_li->append_tag_to_content($input_label);
     $input_li->append_tag_to_content($input_tag);
     if (strlen($post_content) > 0) {
         $input_li->append_str_to_content($post_content);
     }
     $input_msg_box = new HTMLTags_Span();
     $input_msg_box->set_attribute_str('id', $name . 'msg');
     $input_msg_box->set_attribute_str('class', 'rules');
     $input_li->append_tag_to_content($input_msg_box);
     if (count($this->input_lis) == 0) {
         $this->first_input_name = $name;
     }
     $this->input_lis[] = $input_li;
 }
 public function get_input_lis()
 {
     $input_lis = array();
     $visible_fields = $this->get_visible_fields();
     foreach ($visible_fields as $visible_field) {
         if ($visible_field->get_name() != 'id') {
             $input_li = new HTMLTags_LI();
             $l_t_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($visible_field->get_name(), '_');
             $label_text = $l_t_l_o_ws->get_words_as_capitalised_string();
             $input_label = new HTMLTags_Label($label_text);
             $input_label->set_attribute_str('for', $visible_field->get_name());
             #$input_label->set_attribute_str('id', $visible_field->get_name());
             $input_li->append_tag_to_content($input_label);
             $field_renderer = $visible_field->get_renderer();
             $input_tag = $field_renderer->get_form_input();
             #print_r($visible_field);
             if ($visible_field->has_default()) {
                 $input_tag->set_value($visible_field->get_default());
             }
             $input_li->append_tag_to_content($input_tag);
             $input_lis[] = $input_li;
         }
     }
     return $input_lis;
 }
 public function get_module_name_as_l_o_w()
 {
     $module_name_as_l_o_w = null;
     if (preg_match('{([^\\\\/]+)$}', $this->get_name(), $matches)) {
         $module_name_as_l_o_w = Formatting_ListOfWords::get_list_of_words_for_string($matches[1], '-');
     }
     return $module_name_as_l_o_w;
 }
 public function validate_in_array($input, $array, $field_name)
 {
     if (!in_array($input, $array)) {
         $error_message = "The {$field_name} must be ";
         $options_l_o_w = Formatting_ListOfWords::get_list_of_words_for_string($array);
         $error_message .= $options_l_o_w->get_words_as_conjunction_list('or');
         throw new InputValidation_InvalidInputException($error_message);
     }
     return TRUE;
 }
 public function get_managed_object_name_plural()
 {
     $table_name = $this->get_table_name();
     #echo $table_name;
     if (preg_match('/^(?:ps_|hpi_|hci_)(\\w+)/', $table_name, $matches)) {
         #echo "Match\n";
         #
         #print_r($matches);
         $table_name = $matches[1];
     } else {
         echo "No match!\n";
     }
     $c = Formatting_ListOfWords::capitalise_delimited_string($table_name, '_');
     #echo $c;
     #exit;
     return $c;
 }
 public function get_title()
 {
     if (isset($this->title)) {
         return $this->title;
     }
     if ($this->has_page_config_file()) {
         $page_config_file = $this->get_page_config_file();
         if ($page_config_file->has_page_title()) {
             return $page_config_file->get_page_title();
         }
     }
     /**
      * Work out the title from the link.
      */
     $title_as_l_o_w = Formatting_ListOfWords::get_list_of_words_for_string($this->get_page_name(), '-');
     return $title_as_l_o_w->get_words_as_capitalised_string();
 }
 public static function get_action_th($action_str)
 {
     $title_low = Formatting_ListOfWords::get_list_of_words_for_string($action_str);
     return new HTMLTags_TH($title_low->get_words_as_capitalised_string());
 }
    protected function render_form_li_textarea($name, $value = NULL, $title = NULL, $cols = 50, $rows = 20)
    {
        #echo $value; exit;
        if (!isset($title)) {
            $title = Formatting_ListOfWords::capitalise_delimited_string($name, '_');
        }
        ?>
<li>
	<label for="page"><?php 
        echo $title;
        ?>
</label>
	<textarea
		name="<?php 
        echo $name;
        ?>
"
		id="<?php 
        echo $name;
        ?>
"
		cols="<?php 
        echo $cols;
        ?>
"
		rows="<?php 
        echo $rows;
        ?>
"
	><?php 
        if (isset($value)) {
            $value = stripcslashes($value);
            echo $value;
        }
        ?>
</textarea>
	<span
		id="<?php 
        echo $name;
        ?>
msg"
		class="rules"
	></span>
</li>
<?php 
    }
 public function get_module_name_as_l_o_w()
 {
     $project_directory = $this->get_project_directory();
     $project_name = $project_directory->get_current_project_name();
     $p_n_l_o_ws = Formatting_ListOfWords::get_list_of_words_for_string($project_name, '-');
     return $p_n_l_o_ws;
 }
 /**
  * Makes the content of the action TD.
  *
  * Refactor common elements with
  * 	Database_CRUDAdminPage::make_content_for_action_td_for_item
  *
  */
 public function make_content_for_action_td($action_name, $identifiers)
 {
     #print_r($identifiers);
     #exit;
     switch ($action_name) {
         case 'shift_back':
             $non_link_key = $this->get_key_of_current_max();
             break;
         case 'shift_forward':
             $non_link_key = $this->get_key_of_current_min();
             break;
         default:
             throw new Exception('Unknown action name!');
     }
     #print_r($non_link_key);
     $non_link = TRUE;
     foreach ($non_link_key as $k => $v) {
         if ($identifiers[$k] != $v) {
             $non_link = FALSE;
             break;
         }
     }
     if ($non_link) {
         return '&nbsp;';
     } else {
         $c = Formatting_ListOfWords::capitalise_delimited_string($action_name, '_');
         $a = new HTMLTags_A($c);
         $url = $this->get_action_redirect_script_url($action_name, $identifiers);
         $a->set_href($url);
         return $a->get_as_string();
     }
 }
 public function get_title_for_page_in_module_in_section($page, $module, $section)
 {
     $page_element = $this->get_page_element_in_module_in_section($page, $module, $section);
     $title = '';
     if ($page_element->hasAttribute('title')) {
         $title = $page_element->getAttribute('title');
     } else {
         $ptlow = Formatting_ListOfWords::get_list_of_words_for_string($page_element->getAttribute('name'), $separator = '-');
         $title = $ptlow->get_words_as_capitalised_string();
     }
     return $title;
 }
 public function get_html_tags_dt()
 {
     $dt = new HTMLTags_DT();
     $field = $this->get_element();
     $field_name_l_o_w = Formatting_ListOfWords::get_list_of_words_for_string($field->get_name(), '_');
     $dt->append_str_to_content($field_name_l_o_w->get_words_as_capitalised_string());
     return $dt;
 }
 public function get_field_class_name($field_name)
 {
     if (!isset($this->field_class_names[$field_name])) {
         $this->field_class_names[$field_name] = $this->get_table_class_name();
         $field_name_l_o_w = Formatting_ListOfWords::get_list_of_words_for_string($field_name, '_');
         $this->field_class_names[$field_name] .= $field_name_l_o_w->get_words_as_camel_case_string();
         $this->field_class_names[$field_name] .= 'Field';
     }
     return $this->field_class_names[$field_name];
 }
示例#16
0
             if (preg_match('/^hpi_(\\w+)/', $table, $matches)) {
                 $short_table_name = $matches[1];
             }
         }
     }
     $table_module_name = $class_module;
     if (preg_match('/^' . $table_module_name . '_(\\w+)/', $short_table_name, $matches)) {
         //echo 'print_r($matches): ' . "\n";
         //print_r($matches);
         $short_table_name = $matches[1];
         //} else {
         //    echo "No match!\n";
     }
 }
 $class_name .= '_';
 $stn_low = Formatting_ListOfWords::get_list_of_words_for_string($short_table_name, '_');
 //echo 'print_r($stn_low): ' . "\n";
 //print_r($stn_low);
 $class_name .= $stn_low->get_words_as_camel_case_string();
 switch ($entity) {
     case 'table':
         $class_name .= 'Table';
         break;
 }
 echo "Class name: {$class_name}\n";
 echo "Is this class name acceptable?\n";
 $class_name_acceptable = CLIScripts_InputReader::ask_yes_no_question();
 if (!$class_name_acceptable) {
     echo "Please type the name of the class:\n";
     $class_name = trim(fgets(STDIN));
 }