public function suggestAction() { $stub = trim($this->_getParam('q')); if (mb_strlen($stub) > 1) { $suggestions = $this->tagService->getTags(array('tag like ' => $stub . '%')); foreach ($suggestions as $tag) { echo $tag['tag'] . "\r\n"; } } }
/** * Proxy the call to delete * * @param string|object $table * @param string $where */ public function delete($table, $where = '') { if (is_object($table)) { $where = 'id = ' . $table->id; if ($this->searchService != null) { $this->searchService->delete($table); } if ($this->tagService != null) { $this->tagService->deleteTags($table, za()->getUser()); } if ($this->itemLinkService != null) { $this->itemLinkService->deleteItem($table); } $table = get_class($table); } $table = strtolower($table); $return = false; try { $this->beginTransaction(); if (is_array($where)) { $where = $this->bindValues($where); } $this->proxied->delete($table, $where); $return = true; $this->commit(); } catch (Exception $e) { error_log(get_class($e) . " - Caught: " . $e->getMessage()); error_log($e->getTraceAsString()); $this->rollBack(); throw $e; } return $return; }
/** * Start recording time for a particular task */ public function recordAction() { $task = $this->projectService->getTask($this->_getParam('id')); $user = za()->getUser(); $time = time(); $record = $this->projectService->addTimesheetRecord($task, $user, $time, $time); $this->view->task = $task; $this->view->record = $record; $this->view->relatedFaqs = $this->tagService->getRelatedItems($task); $this->renderRawView('timesheet/record.php'); }
/** * Will automatically attempt to save an object when * called */ public function saveAction($modelType = '') { $model = null; try { $this->dbService->beginTransaction(); $params = $this->filterParams($this->_getAllParams()); $model = $this->projectService->saveTask($params, true); // Now save the tags for that model $tagstr = $this->_getParam('tags'); if (!mb_strlen($tagstr)) { // go and get some suggested tags! if (mb_strlen($model->description)) { $possibles = $this->tagService->suggestTagsFor($model->description); if (count($possibles) > 0) { $tagstr = implode(",", $possibles); } } } if ($tagstr) { $this->log->debug("Adding tags {$tagstr} to task #{$model->id}"); $this->tagService->saveTags($model, $tagstr); } $this->dbService->commit(); } catch (InvalidModelException $ime) { za()->log("Faild saving task :" . $ime->getMessage(), Zend_Log::ERR); $this->dbService->rollback(); $this->flash($ime->getMessages()); $model = new Task(); $model->bind($this->_getAllParams()); $this->editAction($model); return; } catch (Exception $e) { za()->log("Faild saving task :" . $e->getMessage(), Zend_Log::ERR); $this->dbService->rollback(); $this->flash($e->getMessage()); $model = new Task(); $model->bind($this->_getAllParams()); $this->editAction($model); return; } $this->onModelSaved($model); }
<?php require_once ykfile("source/mooc_service.php"); require_once ykfile("source/tag_service.php"); // 判断是否有id 如果有 就是编辑 否则就是添加 $mooc_id = intval($_GET['mooc_id']); $moocSer = new MoocService(); $mooc = $moocSer->get_by_id($mooc_id); // 获取所有的标签对象 $tagSer = new TagService(); $tag_list = $tagSer->get_all(); if ($mooc == NULL || $mooc == 3001) { $mooc = new ActivityModule(); $mooc->type = ActivityModel::type_mooc; $mooc->author = new UserModel(); } include ykfile('pages/admin/edit_mooc.php');
<?php require_once "../config.php"; require_once ykfile("source/tag_service.php"); require_once ykfile("source/recent_service.php"); $tag_id = $_GET['id']; // 获取活动类型对应的标签 $tagService = new TagService(); $tag_list = $tagService->get_defualt(RECENT_ACTIVITY_CHANNEL); $page_title = "约 · 活动"; //通过标签和活动类型来取预告的列表 $recentService = new RecentService(); $recent_activity = $recentService->get_recent_by_tagId($tag_id, 0, 10); require_once ykfile("pages/recent/recent_tag.php");
} if (array_key_exists("calories", $_POST)) { $recipe->setcalories($_POST['calories']); } if (array_key_exists("countryId", $_POST)) { $origin = $_POST["countryId"]; if ($origin != "-1") { $recipe->setorigin($origin); } } if (array_key_exists("categoryId", $_POST)) { $category = $_POST["categoryId"]; if ($category != "-1") { $recipe->setcategory($category); } } if (array_key_exists("tags", $_POST)) { $tags = TagService::processTags($_POST["tags"]); foreach ($tags as $current) { $newTag = new tags(); $newTag->settagNames($current); $recipe->addtags($newTag); } } $saved = ItemService::saveWithValidation($recipe, 200); if ($saved == true) { $id = $recipe->getId(); $result = array("id" => $id); echo json_encode($result); } });
/** * Returns the URL of the page tagged with the following contextual tag: * contextual_website_website_modules_form_recommand-page * @return String * @deprecated use sharethis module instead. */ public function getRecommandFormUrl() { try { $page = TagService::getInstance()->getDocumentByContextualTag('contextual_website_website_modules_form_recommand-page', website_WebsiteModuleService::getInstance()->getCurrentWebsite()); $parameters = array('formParam[recommandFeature]' => website_WebsiteModuleService::getInstance()->getCurrentPageId()); return LinkHelper::getUrl($page, null, $parameters); } catch (Exception $e) { Framework::exception($e); } return null; }
// if (isset($casa)) { // echo '<input type="hidden" class="hidden_photo" value="'.$casa->main_photo_name.'"/>'; // } ?> </div> <div class="tags"> <h4>标签 <small>自定义标签请使用逗号分隔</small> </h4> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/TagDao.php'; ?> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/TagService.php'; ?> <?php $tagService = new TagService(); $official_tags = $tagService->getOfficialTags(); $custom_tags = $tagService->getCustomTags(); $selected_official_tag_names = array(); $selected_custom_tag_names = array(); if (isset($casa)) { // current casa's tags foreach ($casa->tags as $tag) { if ($tag->type != 'custom') { array_push($selected_official_tag_names, $tag->name); } else { array_push($selected_custom_tag_names, $tag->name); } } // 将当前客栈的自定义标签转换成以逗号分隔的字符串. $selected_custom_str = implode($selected_custom_tag_names, ',');
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AreaDao.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/AreaService.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/TagService.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/CasaService.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/controllers/AreaController.php'; $area_id = $_GET['area_id']; $areaService = new AreaService(); $picdir = 'http://casarover.oss-cn-hangzhou.aliyuncs.com/casa/'; $city_ids = $areaService->getCityIdsIncludeDirect(); if (!empty($area_id) && in_array($area_id, $city_ids)) { $areaDao = new AreaDao(); $area = new Area($areaDao->getById($area_id)); } else { header('Location:error.php?info=无效城市!'); } $tagService = new TagService(); $officialTags = $tagService->getOfficialTags(); $subAreas = $areaService->getSubAreas($area_id); $casaService = new CasaService(); $casas = array(); // because there may be casa that has no tag, // if one casa has no tag, it will never appear in the result of getForCitySearch(), // root cause is in sql query statement, look into CasaDao.getByMultiConfition(). if (empty($_GET['themes']) && empty($_GET['sceneries'])) { $casas = $casaService->getCasasByCityId($area_id); } else { $casas = $casaService->getForCitySearch($area_id, $_GET['themes'], null, $_GET['sceneries']); } $area = new AreaController(); $message = $area->simpleMess(); ?>