private function submitData() { $position_id = intval(Yii::app()->request->getParam('position_id')); if (!$position_id) { $this->controller->message('error', Yii::t('admin', 'Please Select A Recommend Position')); } $contentModel = ucfirst($this->type_key); $criteria = new CDbCriteria(); $criteria->addInCondition('id', explode(',', $this->content_id)); $criteria->select = 'id, title'; $content = $contentModel::model()->findAll($criteria); if (!$content) { $this->controller->message('error', Yii::t('admin', 'Invialid Content')); } foreach ($content as $c) { $model = new Recommend(); $exist = $model->findByAttributes(array('position_id' => $position_id, 'content_id' => $c->id, 'type' => $this->type_id)); if ($exist) { $exist->title = $c->title; $exist->create_time = time(); $exist->save(); } else { $model->position_id = $position_id; $model->content_id = $c->id; $model->title = $c->title; $model->type = $this->type_id; $model->sort_order = 0; $model->create_time = time(); $model->save(); } //改变内容推荐状态 $contentModel::model()->updateByPk($c->id, array('commend' => 'Y')); } $this->controller->message('success', Yii::t('admin', 'Recommend Success'), $this->controller->createUrl('index')); }
public function run() { $ids = Yii::app()->request->getParam('id'); $sortOrder = Yii::app()->request->getParam('sortOrder'); $command = Yii::app()->request->getParam('command'); empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select')); if (!is_array($ids)) { $ids = array($ids); } $criteria = new CDbCriteria(); $criteria->addInCondition('id', $ids); switch ($command) { case 'sortOrder': //推荐内容排序 foreach ($ids as $id) { Recommend::model()->updateByPk($id, array('sort_order' => $sortOrder[$id])); } break; case 'unCommend': //取消推荐内容 Recommend::model()->deleteAll($criteria); break; default: throw new CHttpException(404, Yii::t('admin', 'Error Operation')); } $this->controller->message('success', Yii::t('admin', 'Batch Operate Success')); }
/** * Load the component Recommend. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $objTemplate, $_CORELANG, $subMenuTitle; switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: $objRecommend = new Recommend(\Env::get('cx')->getPage()->getContent()); \Env::get('cx')->getPage()->setContent($objRecommend->getPage()); break; case \Cx\Core\Core\Controller\Cx::MODE_BACKEND: $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html'); $objTemplate = $this->cx->getTemplate(); \Permission::checkAccess(64, 'static'); $subMenuTitle = $_CORELANG['TXT_RECOMMEND']; $objCalendar = new RecommendManager(); $objCalendar->getPage(); break; default: break; } }
/** * 判断数据是否存在 * * return \$this->model */ public function loadModel() { if ($this->model === null) { if (isset($_GET['id'])) { $this->model = Recommend::model()->findbyPk($_GET['id']); } if ($this->model === null) { throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.')); } } return $this->model; }
public function run() { $ids = Yii::app()->request->getParam('id'); $command = Yii::app()->request->getParam('command'); empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select')); if (!is_array($ids)) { $ids = array($ids); } $criteria = new CDbCriteria(); $criteria->addInCondition('id', $ids); switch ($command) { case 'delete': //删除 RecommendPosition::model()->deleteAll($criteria); //同时删除推荐的内容 $criteria_r = new CDbCriteria(); $criteria_r->addInCondition('position_id', $ids); Recommend::model()->deleteAll($criteria_r); break; default: $this->controller->message('error', Yii::t('admin', 'Error Operation')); } $this->controller->message('success', Yii::t('admin', 'Batch Operate Success')); }
function recordRecommend($weixin_id) { $user = new User(); $result = $user->findByWeixin($weixin_id); if ($result) { $recommend = new Recommend(); $result = $recommend->findDetailById($weixin_id); $str = ""; foreach ($result as $key => $value) { $str = $str . $value['name']; if ($value['status'] == 0) { $str = $str . "(此用户已经停用)"; } $str = $str . "," . $value['date'] . "\n"; } if (empty($str)) { return '对不起,您还没有推荐记录,加油!'; } else { return "您的推荐记录为:\n" . $str; } } else { return '您还没有登记,登记后才能推荐,请联系米蝶财务0371-86089000'; } }
public function recommend() { $userid = self::get_user(); $recommend = new Recommend($userid); $recomdata = $recommend->currentrecommend(); while ($rowsrecom = $recomdata->fetch_object()) { $avatarUrl = (object) $recommend->getavatar($rowsrecom->fromid); $this->data = $rowsrecom; $arrCount = (array) $avatarUrl; $arrData = (array) $this->data; $this->recommenddata[] = (object) array_merge($arrCount, $arrData); } // echo "<pre>"; // print_r($this->recommenddata);exit; }
<?php include_once "../../../../../../libraries/aces/models/recommend.php"; // echo json_encode("Alice Ng"); $filter = "id=" . $_POST['idcom']; // echo json_encode($filter); $recom = new Recommend(); $data = $recom->currentrecommendajax($filter); foreach ($data as $recomdata) { echo json_encode($recomdata); }
{ // require_once(BASE_DIR . '/modules/recommend/class.recommend.php'); // require_once(BASE_DIR . '/functions/func.modulglobals.php'); // // set_modul_globals('recommend'); // $recommend = new Recommend; // $recommend->displayLink(); ?> <a href="javascript:void(0);" onclick="popup('<?php echo ABS_PATH; ?> index.php?module=recommend&action=form&pop=1&theme_folder=ave&page=<?php echo base64_encode(get_redirect_link()); ?> ','recommend','500','380','1');">Рекомендовать сайт</a> <?php } if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'recommend' && isset($_REQUEST['action'])) { require_once BASE_DIR . '/modules/recommend/class.recommend.php'; require_once BASE_DIR . '/functions/func.modulglobals.php'; set_modul_globals('recommend'); $recommend = new Recommend(); switch ($_REQUEST['action']) { case 'form': $recommend->displayForm($_REQUEST['theme_folder']); break; case 'recommend': $recommend->sendForm($_REQUEST['theme_folder']); break; } }
public function getShowRecommend($id) { $recommend = Recommend::find($id); $columns = Schema::getColumnListing('recommend'); return View::make('admin.show_recommend')->with('recommend', $recommend)->with('columns', $columns); }
<?php //首页推荐接口 require_once '../../models/Response.php'; require_once '../../models/Recommend.php'; $style = new Response(); if ($_GET['page']) { $pageId = $_GET['page']; $uid = isset($_GET['uid']) ? $_GET['uid'] : NULL; $rec = new Recommend(); $data = $rec->recommend($pageId, $uid); $res = new Response(); echo $res->show('200', $data); } else { echo Response::show('400'); }
/** * 批量操作 * */ public function actionBatch() { if ($this->method() == 'GET') { $command = trim($_GET['command']); $ids = intval($_GET['id']); } else { if ($this->method() == 'POST') { $command = trim($_POST['command']); $ids = $_POST['id']; } else { $this->message('errorBack', Yii::t('admin', 'Only POST Or GET')); } } empty($ids) && $this->message('error', Yii::t('admin', 'No Select')); switch ($command) { case 'sortOrder': //排序 $sortOrder = $_POST['sortOrder']; foreach ((array) $ids as $id) { $recModel = Recommend::model()->find('content_id=:id', array(':id' => $id)); if ($recModel) { $recModel->sort_order = $sortOrder[$id]; $recModel->save(); } } break; case 'Delete': foreach ((array) $ids as $id) { $reModel = RecommendPosition::model()->findByPk($id); if ($reModel) { $reModel->delete(); //同时删除推荐的内容 Recommend::model()->deleteAll('id=' . $id); } } break; case 'unCommend': //取消推荐 $uncommend = $_POST['unCommend']; foreach ((array) $ids as $id) { $recModel = Recommend::model()->find('content_id=:id', array(':id' => $id)); if ($recModel) { $recModel->delete(); } } break; default: throw new CHttpException(404, Yii::t('admin', 'Error Operation')); break; } $this->message('success', Yii::t('admin', 'Batch Operate Success'), $this->createUrl('index')); }
function get_other_ratings($user_id) { $ratings = array('rating', 'house_id'); $this->db->select('user_id'); $this->db->from('ratings'); $query = $this->db->get(); $queryArr = $query->result_array(); foreach ($queryArr as $row) { $this->db->select('user_id, house_id, rating'); $this->db->from('ratings'); $this->db->where('user_id', $row['user_id']); $query2 = $this->db->get(); $result2 = $query2->result_array(); foreach ($result2 as $row) { $house_id_and_rating = $row['rating']; if ($row['rating'] != 0 || $query2->num_rows() <= 0) { $data2[$row['house_id']] = $house_id_and_rating; //use the house id as the index for the ratings } } $final[$row['user_id']] = $data2; } return $final; require_once "recommend.php"; $re = new Recommend(); echo "<pre>"; print_r($re->getRecommendations($data, "3")); echo "</pre>"; }
<?php require_once "recommend.php"; require_once "sample_list.php"; $re = new Recommend(); echo "<pre>"; print_r($re->getRecommendations($books, "bruce")); echo "</pre>";
public function postFrequency() { if (Request::ajax()) { if (Input::get('type') == 'link') { $link = Link::where('id', '=', Input::get('link'))->firstOrFail(); $link->frequency = $link->frequency + 1; $link->timestamps = false; $link->save(); } elseif (Input::get('type') == 'recommend') { $recommend = Recommend::where('id', '=', Input::get('link'))->firstOrFail(); $recommend->frequency = $recommend->frequency + 1; $recommend->timestamps = false; $recommend->save(); } elseif (Input::get('type') == 'gov') { $gov = Gov::where('id', '=', Input::get('link'))->firstOrFail(); $gov->frequency = $gov->frequency + 1; $gov->timestamps = false; $gov->save(); } } else { App::abort(404); } }
<?php // define( '_JEXEC', 1 ); // define( 'DS', DIRECTORY_SEPARATOR ); // define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] ); // require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' ); // require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' ); // require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' ); // $mainframe =& JFactory::getApplication('site'); include_once "../../../../../../libraries/aces/models/recommend.php"; // $user = CFactory::getUser($_POST['userid']); // $avatarUrl = $user->getThumbAvatar(); // $_POST['imageurl'] = $avatarUrl; $_POST['userid'] = $_POST['userid']; $_POST['fromid'] = $_POST['fromid']; $_POST['recommend'] = $_POST['recommend']; $_POST['message'] = $_POST['message']; $_POST['relationship'] = $_POST['relationship']; $_POST['created'] = date("Y-m-d h:i:s"); $recom = new Recommend(); $data = $recom->create($_POST); // echo json_encode($data);