function request_suggest($key) { $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET); global $hmtaxonomy; global $hmcontent; $return = ''; $input_name = hm_post('input', ''); $key = trim($key); $key = str_replace(' ', '-', $key); if ($key != '') { $tableName = DB_PREFIX . 'request_uri'; $hmdb->Query("SELECT * FROM `" . $tableName . "` WHERE `uri` LIKE '%" . $key . "%' LIMIT 10"); while ($row = $hmdb->Row()) { $id = $row->id; $object_id = $row->object_id; $object_type = $row->object_type; $uri = $row->uri; $suggest_label = ''; $object_name = ''; switch ($object_type) { case 'taxonomy': $tax_data = taxonomy_data_by_id($object_id); $tax_key = $tax_data['taxonomy']->key; $taxonomy = $hmtaxonomy->hmtaxonomy; $suggest_label = $taxonomy[$tax_key]['taxonomy_name']; $object_name = get_tax_val('name=name&id=' . $object_id); break; case 'content': $con_data = content_data_by_id($object_id); $con_key = $con_data['content']->key; $content = $hmcontent->hmcontent; $suggest_label = $content[$con_key]['content_name']; $object_name = get_con_val('name=name&id=' . $object_id); break; } $return .= '<li>'; $return .= '<p data-id="' . $id . '" data-input="' . $input_name . '" data-name="' . $object_name . '" object_id="' . $object_id . '" object_type="' . $object_type . '">'; $return .= '<span class="suggest_label">' . $suggest_label . ': </span><b>' . $object_name . '</b>'; $return .= '</p>'; $return .= '</li>'; } } return $return; }
function hm_title() { hook_action('before_hm_title'); global $hmcontent; global $hmtaxonomy; $request = get_current_uri(); $request_data = get_uri_data(array('uri' => $request)); if ($request == '') { $home_title = get_option(array('section' => 'system_setting', 'key' => 'website_name', 'default_value' => 'Một trang web sử dụng HoaMaiCMS')); if ($home_title != '') { $title = '<title>' . $home_title . '</title>' . "\n\r"; } else { $title = FALSE; } return hook_filter('hm_title', $title); } else { if ($request_data != FALSE) { $object_type = $request_data->object_type; $object_id = $request_data->object_id; switch ($object_type) { case 'content': $content_data = content_data_by_id($object_id); $title = $content_data['content']->name; $title = '<title>' . $title . '</title>' . "\n\r"; return hook_filter('hm_title', $title); break; case 'taxonomy': $taxonomy_data = taxonomy_data_by_id($object_id); $title = $taxonomy_data['taxonomy']->name; $title = '<title>' . $title . '</title>' . "\n\r"; return hook_filter('hm_title', $title); break; } } else { return FALSE; } } hook_action('after_hm_title'); }
$key = hm_get('key'); $id = hm_get('id'); $action = hm_get('action'); switch ($action) { case 'add': /** Thực hiện thêm taxonomy trả về array */ $args = taxonomy_data($key); /** Hiển thị giao diện thêm taxonomy bằng array ở trên */ function admin_content_page() { global $args; require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'taxonomy_add.php'; } break; case 'edit': $args_tax = taxonomy_data_by_id($id); $key = $args_tax['taxonomy']->key; $args = taxonomy_data($key); function admin_content_page() { global $args; global $args_tax; require_once BASEPATH . HM_ADMINCP_DIR . '/' . LAYOUT_DIR . '/' . 'taxonomy_edit.php'; } break; default: $args = taxonomy_show_all($key); /** Hiển thị giao diện thêm tất cả taxonomy */ function admin_content_page() { global $args;