Exemple #1
0
 /**
  * serializeProperty
  *
  * @param ClassMeta $meta
  * @param $propName
  * @param $value
  * @param \DOMElement $target
  * @throws \RuntimeException
  */
 private static function serializeProperty(ClassMeta $meta, $propName, $value, \DOMElement $target)
 {
     if ($value === null) {
         return;
     }
     $valueType = self::getValueType($value);
     $attrName = $meta->getAttributeName($propName, $valueType);
     if ($attrName) {
         $target->setAttribute($attrName, self::formatAtomicValue($value));
     }
     $elementName = $meta->getElementName($propName, $valueType);
     if ($elementName) {
         $child = $target->ownerDocument->createElement($elementName);
         if (self::isObject($value)) {
             self::serializeObject($value, $child);
         } else {
             $text = self::formatAtomicValue($value);
             $child->appendChild($target->ownerDocument->createTextNode($text));
         }
         $target->appendChild($child);
     }
     if (!$attrName && !$elementName) {
         throw new \RuntimeException("Don't know how to serialize value of type '{$valueType}' for property '{$propName}' of class '{$meta->getClassName()}'");
     }
 }
Exemple #2
0
 public function edit_post()
 {
     $data = $this->data;
     //取得公用數據
     $this->form_validation->set_rules('classname_Str', 'classname_Str', 'required');
     if ($this->form_validation->run() !== FALSE) {
         $classid_Num = $this->input->post('classid_Num', TRUE);
         $classname_Str = $this->input->post('classname_Str', TRUE);
         $prioritynum_Num = $this->input->post('prioritynum_Num', TRUE);
         $class_ClassMeta = new ClassMeta();
         $class_ClassMeta->construct(array('classid_Num' => $classid_Num, 'classname_Str' => $classname_Str, 'prioritynum_Num' => $prioritynum_Num, 'modelname_Str' => 'advertising'));
         $class_ClassMeta->update(array());
         $this->load->model('Message');
         $this->Message->show(array('message' => '設定成功', 'url' => 'admin/base/advertising/classmeta/tablelist'));
     } else {
         $this->load->model('Message');
         $this->Message->show(array('message' => validation_errors(), 'url' => 'admin/base/advertising/classmeta/tablelist'));
     }
 }
Exemple #3
0
 public function delete()
 {
     $hash_Str = $this->input->get('hash');
     $classid_Num = $this->input->get('classid');
     //CSRF過濾
     if ($hash_Str == $this->security->get_csrf_hash()) {
         $ClassMeta = new ClassMeta();
         $ClassMeta->construct(array('classid_Num' => $classid_Num));
         $ClassMeta->destroy();
         $this->load->model('Message');
         $this->Message->show(array('message' => '刪除成功', 'url' => 'admin/base/note/classmeta/tablelist'));
     } else {
         $this->load->model('Message');
         $this->Message->show(array('message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/note/classmeta/tablelist'));
     }
 }
Exemple #4
0
 /**
  * createSchemaNodeForSingleElementProperty
  *
  * @param \DOMDocument $doc
  * @param ClassMeta $meta
  * @param $elementName
  * @return \DOMElement
  */
 private function createSchemaNodeForSingleElementProperty(\DOMDocument $doc, ClassMeta $meta, $elementName)
 {
     $result = $doc->createElement("xs:element");
     $result->setAttribute("name", $elementName);
     $type = $meta->getPropertyTypeForElement($elementName);
     $this->mentionType($type);
     $result->setAttribute("type", $this->getXsdType($type));
     $result->setAttribute("minOccurs", 0);
     return $result;
 }
Exemple #5
0
 /**
  * registerMeta
  * @param ClassMeta $meta
  */
 protected function registerMeta(ClassMeta $meta)
 {
     $key = $this->getKey($meta->getClassName());
     $this->data[$key] = $meta;
 }
Exemple #6
0
 public function tablelist()
 {
     $data = $this->data;
     //取得公用數據
     $data = array_merge($data, $this->AdminModel->get_data(array('child4_name_Str' => 'tablelist')));
     $data['search_productid_Num'] = $this->input->get('productid');
     $data['search_name_Str'] = $this->input->get('name');
     $data['search_class_slug_Str'] = $this->input->get('class_slug');
     $data['search_warehouseid_Str'] = $this->input->get('warehouseid');
     $data['search_shelves_status_Num'] = $this->input->get('shelves_status');
     //預設顯示已上架產品
     if (empty($data['search_shelves_status_Num'])) {
         $data['search_shelves_status_Num'] = 1;
     }
     $limitstart_Num = $this->input->get('limitstart');
     $limitcount_Num = $this->input->get('limitcount');
     $limitcount_Num = !empty($limitcount_Num) ? $limitcount_Num : 20;
     $class_ClassMeta = new ClassMeta();
     $class_ClassMeta->construct_db(array('db_where_Arr' => array('slug_Str' => $data['search_class_slug_Str'])));
     $data['product_ProductShopList'] = new ObjList();
     $data['product_ProductShopList']->construct_db(array('db_where_Arr' => array('productid_Num' => $data['search_productid_Num'], 'shelves_status' => $data['search_shelves_status_Num']), 'db_where_like_Arr' => array('name_Str' => $data['search_name_Str'], 'warehouseid_Str' => $data['search_warehouseid_Str']), 'db_where_or_Arr' => array('classids' => array($class_ClassMeta->classid_Num)), 'db_orderby_Arr' => array(array('prioritynum', 'DESC'), array('productid', 'DESC')), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'ProductShop', 'limitstart_Num' => $limitstart_Num, 'limitcount_Num' => $limitcount_Num));
     $data['product_links'] = $data['product_ProductShopList']->create_links(array('base_url_Str' => 'admin/' . $data['child1_name_Str'] . '/' . $data['child2_name_Str'] . '/' . $data['child3_name_Str'] . '/' . $data['child4_name_Str']));
     $data['class_ClassMetaList'] = new ObjList();
     $data['class_ClassMetaList']->construct_db(array('db_where_Arr' => array('modelname_Str' => 'product_shop'), 'model_name_Str' => 'ClassMeta', 'limitstart_Num' => 0, 'limitcount_Num' => 100));
     //global
     $data['global']['style'][] = 'admin/global.css';
     $data['global']['js'][] = 'admin.js';
     //temp
     $data['temp']['header_up'] = $this->load->view('temp/header_up', $data, TRUE);
     $data['temp']['header_down'] = $this->load->view('temp/header_down', $data, TRUE);
     $data['temp']['admin_header_bar'] = $this->load->view('admin/temp/admin_header_bar', $data, TRUE);
     $data['temp']['admin_footer_bar'] = $this->load->view('admin/temp/admin_footer_bar', $data, TRUE);
     $data['temp']['body_end'] = $this->load->view('temp/body_end', $data, TRUE);
     //輸出模板
     $this->load->view('admin/' . $data['admin_child_url_Str'], $data);
 }
Exemple #7
0
 public function tablelist()
 {
     $data = $this->data;
     //取得公用數據
     $data = array_merge($data, $this->AdminModel->get_data(array('child4_name_Str' => 'tablelist')));
     $limitstart_Num = $this->input->get('limitstart');
     $limitcount_Num = $this->input->get('limitcount');
     $limitcount_Num = empty($limitcount_Num) ? 20 : $limitcount_Num;
     $limitcount_Num = $limitcount_Num > 100 ? 100 : $limitcount_Num;
     $data['search_class_slug_Str'] = $this->input->get('class_slug');
     $data['search_title_Str'] = $this->input->get('title');
     $data['search_fileid_Num'] = $this->input->get('fileid');
     $class_ClassMeta = new ClassMeta();
     $class_ClassMeta->construct_db(array('db_where_Arr' => array('uid_Str' => $data['User']->uid_Num, 'slug_Str' => $data['search_class_slug_Str']), 'db_where_deletenull_Bln' => FALSE));
     $data['filelist_FileList'] = new ObjList();
     $data['filelist_FileList']->construct_db(array('db_where_Arr' => array('fileid_Num' => $data['search_fileid_Num'], 'uid_Num' => $data['User']->uid_Num), 'db_where_like_Arr' => array('title_Str' => $data['search_title_Str']), 'db_where_or_Arr' => array('classids_Str' => array($class_ClassMeta->classid_Num)), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'FileObj', 'db_orderby_Arr' => array('prioritynum' => 'DESC', 'updatetime' => 'DESC'), 'limitstart_Num' => $limitstart_Num, 'limitcount_Num' => $limitcount_Num));
     $data['file_links'] = $data['filelist_FileList']->create_links(array('base_url_Str' => "admin/base/file/file/tablelist/?class_slug={$data['search_class_slug_Str']}"));
     $data['file_ClassMetaList'] = $this->load->model('ObjList', nrnum());
     $data['file_ClassMetaList']->construct_db(array('db_where_Arr' => array('uid_Num' => $data['User']->uid_Num, 'modelname' => 'file'), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'ClassMeta', 'db_orderby_Arr' => array(array('prioritynum', 'DESC'), array('updatetime', 'DESC')), 'limitstart_Num' => 0, 'limitcount_Num' => 100));
     //global
     $data['global']['style'][] = 'admin/global.css';
     $data['global']['js'][] = 'admin.js';
     //temp
     $data['temp']['header_up'] = $this->load->view('temp/header_up', $data, TRUE);
     $data['temp']['header_down'] = $this->load->view('temp/header_down', $data, TRUE);
     $data['temp']['admin_header_bar'] = $this->load->view('admin/temp/admin_header_bar', $data, TRUE);
     $data['temp']['admin_footer_bar'] = $this->load->view('admin/temp/admin_footer_bar', $data, TRUE);
     $data['temp']['body_end'] = $this->load->view('temp/body_end', $data, TRUE);
     //輸出模板
     $this->load->view('admin/' . $data['admin_child_url_Str'], $data);
 }
Exemple #8
0
 public function delete()
 {
     $hash_Str = $this->input->get('hash');
     $classid_Num = $this->input->get('classid');
     //CSRF過濾
     if ($hash_Str == $this->security->get_csrf_hash()) {
         $class_ClassMeta = new ClassMeta(['classid_Num' => $classid_Num]);
         $class_ClassMeta->destroy();
         $this->load->model('Message');
         $this->Message->show(['message' => '刪除成功', 'url' => 'admin/base/advertising/classmeta/tablelist/']);
     } else {
         $this->load->model('Message');
         $this->Message->show(['message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/advertising/classmeta/tablelist/']);
     }
 }
Exemple #9
0
 public function tablelist()
 {
     $data = $this->data;
     //取得公用數據
     $data = array_merge($data, $this->AdminModel->get_data(array('child4_name_Str' => 'tablelist')));
     $limitstart_Num = $this->input->get('limitstart');
     $limitcount_Num = $this->input->get('limitcount');
     $limitcount_Num = !empty($limitcount_Num) ? $limitcount_Num : 30;
     $data['search_class_slug_Str'] = $this->input->get('class_slug');
     $data['search_title_Str'] = $this->input->get('title');
     $data['search_picid_Num'] = $this->input->get('picid');
     $data['search_username_Str'] = $this->input->get('username');
     $class_ClassMeta = new ClassMeta();
     $class_ClassMeta->construct_db(array('db_where_Arr' => array('slug_Str' => $data['search_class_slug_Str']), 'db_where_deletenull_Bln' => FALSE));
     $User = new User();
     $User->construct_db(array('db_where_Arr' => array('username' => $data['search_username_Str'])));
     $data['UserGroup_Num'] = $data['User']->group_UserGroupList->obj_Arr[0]->groupid_Num;
     $construct_Arr = ['db_where_Arr' => ['picid' => $data['search_picid_Num'], 'upload_status !=' => 3], 'db_where_like_Arr' => array('title' => $data['search_title_Str']), 'db_where_or_Arr' => array('classids' => array($class_ClassMeta->classid_Num)), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'PicObj', 'db_orderby_Arr' => array('prioritynum' => 'DESC', 'updatetime' => 'DESC'), 'limitstart_Num' => $limitstart_Num, 'limitcount_Num' => $limitcount_Num];
     //搜尋upload_status=2的待分類圖片
     if ($data['search_class_slug_Str'] == 'unclassified') {
         $construct_Arr['db_where_Arr']['upload_status'] = 2;
     } else {
         if ($data['search_class_slug_Str'] == 'hidden') {
             $construct_Arr['db_where_Arr']['upload_status'] = 3;
         }
     }
     if ($data['UserGroup_Num'] == 100) {
         $construct_Arr['db_where_Arr']['uid'] = $data['User']->uid_Num;
     }
     // ec($construct_Arr);
     $data['piclist_PicList'] = new ObjList($construct_Arr);
     $data['pic_links'] = $data['piclist_PicList']->create_links(array('base_url_Str' => "admin/base/pic/pic/tablelist/?class_slug={$data['search_class_slug_Str']}"));
     // ec($data['piclist_PicList']);
     if ($data['UserGroup_Num'] == 100) {
         $data['pic_ClassMetaList'] = $this->load->model('ObjList', nrnum());
         $data['pic_ClassMetaList']->construct_db(array('db_where_Arr' => array('uid_Num' => $data['User']->uid_Num, 'modelname' => 'pic'), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'ClassMeta', 'db_orderby_Arr' => array(array('prioritynum', 'DESC'), array('updatetime', 'DESC')), 'limitstart_Num' => 0, 'limitcount_Num' => 100));
     } else {
         $data['pic_ClassMetaList'] = $this->load->model('ObjList', nrnum());
         $data['pic_ClassMetaList']->construct_db(array('db_where_Arr' => array('modelname' => 'pic'), 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'ClassMeta', 'db_orderby_Arr' => array(array('prioritynum', 'DESC'), array('updatetime', 'DESC')), 'limitstart_Num' => 0, 'limitcount_Num' => 100));
     }
     //global
     $data['global']['style'][] = 'admin/global.css';
     $data['global']['js'][] = 'admin.js';
     //temp
     $data['temp']['header_up'] = $this->load->view('temp/header_up', $data, TRUE);
     $data['temp']['header_down'] = $this->load->view('temp/header_down', $data, TRUE);
     $data['temp']['admin_header_bar'] = $this->load->view('admin/temp/admin_header_bar', $data, TRUE);
     $data['temp']['admin_footer_bar'] = $this->load->view('admin/temp/admin_footer_bar', $data, TRUE);
     $data['temp']['body_end'] = $this->load->view('temp/body_end', $data, TRUE);
     //輸出模板
     $this->load->view('admin/' . $data['admin_child_url_Str'], $data);
 }