コード例 #1
0
 /**
  * Method registerObject
  * @access private
  * @since 1.0.59
  */
 private function registerObject()
 {
     $register_objects = WebSitePhpObject::getRegisterObjects();
     $register_objects[] = $this;
     $_SESSION['websitephp_register_object'] = $register_objects;
 }
コード例 #2
0
ファイル: Table.class.php プロジェクト: kxopa/WebSite-PHP
 /**
  * Method createDbAttributeObject
  * @access private
  * @param mixed $row 
  * @param mixed $list_attribute 
  * @param mixed $list_attribute_type 
  * @param mixed $i 
  * @param mixed $ind 
  * @param mixed $key_attributes 
  * @return mixed
  * @since 1.1.6
  */
 private function createDbAttributeObject($row, $list_attribute, $list_attribute_type, $i, $ind, $key_attributes)
 {
     // get property cmb_obj (created by method loadFromSqlDataView)
     if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'])) {
         $input_obj_tmp = $this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'];
         $input_obj = clone $input_obj_tmp;
         $input_obj->setName($this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
         $register_objects = WebSitePhpObject::getRegisterObjects();
         $register_objects[] = $input_obj;
         $_SESSION['websitephp_register_object'] = $register_objects;
     } else {
         $wspobject = "TextBox";
         $attribute_properties = array();
         if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
             $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         }
         if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") {
             $wspobject = $attribute_properties["wspobject"];
         } else {
             if ($list_attribute_type[$i] == "datetime") {
                 $wspobject = "Calendar";
             } else {
                 if ($list_attribute_type[$i] == "boolean") {
                     $wspobject = "CheckBox";
                 }
             }
         }
         if ($wspobject == "Calendar") {
             $input_obj = new Calendar($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
         } else {
             if ($wspobject == "CheckBox") {
                 $input_obj = new CheckBox($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
             } else {
                 if ($wspobject == "TextArea") {
                     $input_obj = new TextArea($this->table_form_object, $object_id);
                 } else {
                     if ($wspobject == "Editor") {
                         $input_obj = new Editor($this->table_form_object, $object_id);
                         if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") {
                             $input_obj->setToolbar($attribute_properties["editor_param"]);
                         }
                     } else {
                         if ($wspobject == "ComboBox") {
                             $input_obj = new ComboBox($this->table_form_object, $object_id);
                             if (isset($attribute_properties["combobox_values"])) {
                                 if (is_array($attribute_properties["combobox_values"])) {
                                     for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) {
                                         $input_obj->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']);
                                     }
                                 } else {
                                     throw new NewException(get_class($this) . "->loadFromSqlDataView() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1));
                                 }
                             }
                         } else {
                             $input_obj = new TextBox($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
                             if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") {
                                 $input_obj->setWidth(70);
                             }
                             if (in_array($list_attribute[$i], $key_attributes)) {
                                 $lv = new LiveValidation();
                                 $input_obj->setLiveValidation($lv->addValidatePresence());
                             }
                         }
                     }
                 }
             }
         }
     }
     // get properties width and strip_tags
     if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
         $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         if (isset($attribute_properties["width"]) && method_exists($input_obj, "setWidth")) {
             $input_obj->setWidth($attribute_properties["width"]);
         }
         if (isset($attribute_properties["height"]) && method_exists($input_obj, "setHeight")) {
             $input_obj->setHeight($attribute_properties["height"]);
         }
         if (isset($attribute_properties["class"]) && method_exists($input_obj, "setClass")) {
             $input_obj->setClass($attribute_properties["class"]);
         }
         if (isset($attribute_properties["style"]) && method_exists($input_obj, "setStyle")) {
             $input_obj->setStyle($attribute_properties["style"]);
         }
         if (isset($attribute_properties["disable"])) {
             if ($attribute_properties["disable"] == true && method_exists($input_obj, "disable")) {
                 $input_obj->disable();
             } else {
                 if ($attribute_properties["disable"] == false && method_exists($input_obj, "enable")) {
                     $input_obj->enable();
                 }
             }
         }
         if (get_class($input_obj) != "Calendar") {
             if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($input_obj, "setStripTags")) {
                 if (isset($attribute_properties["allowable_tags"])) {
                     $input_obj->setStripTags($attribute_properties["allowable_tags"]);
                 } else {
                     $input_obj->setStripTags("");
                     // no tag allowed
                 }
             }
         }
     }
     if ($row != null) {
         // get property db_attribute
         $field_value = $row->getValue($list_attribute[$i]);
         if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]["db_attribute"])) {
             $db_attribute = $this->from_sql_data_view_properties[$list_attribute[$i]]["db_attribute"];
             $field_value = $row->getValue($db_attribute);
         }
         $input_obj->onChange("onChangeTableFromSqlDataView")->setAjaxEvent()->disableAjaxWaitMessage();
         if (get_class($input_obj) == "TextBox") {
             $input_obj->onKeyUpJs("if (\$(this)[0].defaultValue != \$(this).val()) { \$('#" . $this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i] . "').hide(); } else { \$('#" . $this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i] . "').show(); }");
         }
         if ($list_attribute_type[$i] == "boolean") {
             if (!$input_obj->isChanged()) {
                 $input_obj->setValue($field_value == true ? "on" : "off");
             }
         } else {
             if (gettype($field_value) == "object") {
                 $input_obj->setValue($field_value);
             } else {
                 $input_obj->setValue(utf8encode($field_value));
             }
         }
     }
     return $input_obj;
 }
コード例 #3
0
ファイル: Page.class.php プロジェクト: kxopa/WebSite-PHP
 /**
  * Method addLogDebugRegisterObjects
  * @access public
  * @param string $class_filter 
  * @since 1.1.6
  */
 public function addLogDebugRegisterObjects($class_filter = '')
 {
     $register_objects = WebSitePhpObject::getRegisterObjects();
     $this->addLogDebug("<b>RegisterObjects:</b> ");
     for ($i = 0; $i < sizeof($register_objects); $i++) {
         if ($class_filter == "" || get_class($register_objects[$i]) == $class_filter) {
             $tmp_log = get_class($register_objects[$i]);
             if (method_exists($register_objects[$i], "getId")) {
                 $tmp_log .= ", id=" . $register_objects[$i]->getId();
             }
             if (method_exists($register_objects[$i], "getName")) {
                 $tmp_log .= ", name=" . $register_objects[$i]->getName();
             }
             $this->addLogDebug($tmp_log);
         }
     }
     $this->addLogDebug();
 }
コード例 #4
0
ファイル: index-ajax.php プロジェクト: kxopa/WebSite-PHP
         $ajax_render = str_replace("{#BASE_URL#}", BASE_URL, str_replace("{#CDN_BASE_URL#}", $page_object->getCDNServerURL(), str_replace("{#QUOTE#}", "\"", str_replace("{#SIMPLE_QUOTE#}", "'", $add_to_render[$i]->getAjaxRender()))));
         if ($ajax_render != "") {
             $array_ajax_object_render[] = $ajax_render;
         }
     }
 }
 $register_objects = WebSitePhpObject::getRegisterObjects();
 for ($i = 0; $i < sizeof($register_objects); $i++) {
     $object = $register_objects[$i];
     if ($object->isObjectChange() && get_class($object) != "DialogBox" && !is_subclass_of($object, "DialogBox") && get_class($object) != "JavaScript") {
         $ajax_render = str_replace("{#BASE_URL#}", BASE_URL, str_replace("{#CDN_BASE_URL#}", $page_object->getCDNServerURL(), str_replace("{#QUOTE#}", "\"", str_replace("{#SIMPLE_QUOTE#}", "'", $object->getAjaxRender()))));
         if ($ajax_render != "") {
             $array_ajax_object_render[] = $ajax_render;
         }
     }
     $register_objects = WebSitePhpObject::getRegisterObjects();
 }
 $add_to_render = $page_object->getEndAddedObjects();
 for ($i = 0; $i < sizeof($add_to_render); $i++) {
     if (gettype($add_to_render[$i]) == "object") {
         $ajax_render = str_replace("{#BASE_URL#}", BASE_URL, str_replace("{#CDN_BASE_URL#}", $page_object->getCDNServerURL(), str_replace("{#QUOTE#}", "\"", str_replace("{#SIMPLE_QUOTE#}", "'", $add_to_render[$i]->getAjaxRender()))));
         if ($ajax_render != "") {
             $array_ajax_object_render[] = $ajax_render;
         }
     }
     if ($page_object->getNbEndAddedObjects() > $nb_end_added_object) {
         $add_to_render = $page_object->getEndAddedObjects();
         $nb_end_added_object = $page_object->getNbEndAddedObjects();
     }
 }
 $combine_css = "";
コード例 #5
0
ファイル: Object.class.php プロジェクト: kxopa/WebSite-PHP
 /**
  * Method setId
  * @access public
  * @param string $id 
  * @return Object
  * @since 1.0.36
  */
 public function setId($id)
 {
     $this->id = $id;
     $register_objects = WebSitePhpObject::getRegisterObjects();
     $register_objects[] = $this;
     $_SESSION['websitephp_register_object'] = $register_objects;
     return $this;
 }