本文整理汇总了PHP中Model_Ad类的典型用法代码示例。如果您正苦于以下问题:PHP Model_Ad类的具体用法?PHP Model_Ad怎么用?PHP Model_Ad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Model_Ad类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: feedAction
public function feedAction()
{
$woeid = $this->_request->getParam('woeid');
$ad_type = $this->_request->getParam('ad_type');
$status = $this->_request->getParam('status');
$modelAd = new Model_Ad();
$this->ads = $modelAd->getAdList($woeid, $ad_type, $status, 35);
$rss['title'] = $this->view->translate($ad_type) . ' ' . $this->view->translate((string) $status) . ' - ' . $this->_helper->woeid->name($woeid, $this->lang) . ' | nolotiro.org';
$rss['link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/rss/feed/woeid/' . $woeid . '/ad_type/' . $ad_type . '/status/' . $status;
$rss['charset'] = 'utf-8';
$rss['description'] = 'nolotiro.org - ' . $this->_helper->woeid->name($woeid, $this->lang);
$rss['language'] = $this->lang;
$rss['generator'] = 'nolotiro.org';
$rss['entries'] = array();
foreach ($this->ads as $value) {
$entry = array();
$entry['title'] = $value['title'];
$entry['link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/ad/' . $value['id'] . '/' . $this->view->slugTitle($value['title']);
$entry['description'] = $this->view->escapeEmail($value['body']);
$entry['lastUpdate'] = strtotime($value['date_created']);
$rss['entries'][] = $entry;
}
$feedObj = Zend_Feed::importArray($rss, 'rss');
return $feedObj->send();
}
开发者ID:Arteaga2k,项目名称:nolotiro,代码行数:25,代码来源:RssController.php
示例2: indexAction
public function indexAction()
{
$this->_helper->layout()->setLayout('home');
$this->view->suggestIP = $this->_helper->getLocationGeoIP->suggest();
//check if user is locked
$locked = $this->_helper->checkLockedUser->check();
if ($locked == 1) {
$this->_redirect('/' . $this->view->lang . '/auth/logout');
}
//if user is logged the redir to proper location, if not stand on not logged home view (index)
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$this->_redirect('/' . $this->view->lang . '/woeid/' . $this->location . '/give');
}
//check if request is / redir to /lang
$langIndex = $this->getRequest()->getParam('language');
if ($langIndex == null) {
//add meta robots to not index the page without language param but allow follow-crawl all the rest
//$this->view->metaRobots = 'noindex,follow';
//force redirect with language
$this->_redirect('/es', array('code' => 301));
} else {
$this->view->metaRobots = 'index,follow';
}
//add link rel canonical , better seo
$this->view->canonicalUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang;
$modelAd = new Model_Ad();
$this->view->allGives = $modelAd->getAdListAllHome(1, null);
$this->view->rankingWoeid = $modelAd->getRankingWoeid($limit = 40);
$this->view->rankingUsers = $modelAd->getRankingUsers($limit = 80);
//add meta description to head
$this->view->metaDescription = $this->view->translate('nolotiro.org is a website where you can give away things you no longer want or no longer need to pick them up other people who may serve or be of much use.');
}
开发者ID:Arteaga2k,项目名称:nolotiro,代码行数:33,代码来源:IndexController.php
示例3: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
$ads->where('featured', 'IS NOT', NULL)->where('featured', '>', Date::unix2mysql())->order_by('featured', 'desc');
$ads = $ads->limit($this->ads_limit)->find_all();
$this->ads = $ads;
}
开发者ID:zhangkom,项目名称:openclassifieds2,代码行数:14,代码来源:featured.php
示例4: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
$ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc');
$ads = $ads->limit($this->ads_limit)->cached()->find_all();
$this->ads = $ads;
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:14,代码来源:featured.php
示例5: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$ad = new Model_Ad();
$ad->where('seotitle', '=', Request::current()->param('seotitle'))->limit(1)->find();
if ($ad->loaded()) {
$this->id_ad = $ad->id_ad;
}
}
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:14,代码来源:contact.php
示例6: action_user_contact
public function action_user_contact()
{
$ad = new Model_Ad($this->request->param('id'));
//message to user
if ($ad->loaded() and $this->request->post()) {
$user = new Model_User($ad->id_user);
//require login to contact
if ((core::config('advertisement.login_to_contact') == TRUE or core::config('general.messaging') == TRUE) and !Auth::instance()->logged_in()) {
Alert::set(Alert::INFO, __('Please, login before contacting'));
HTTP::redirect(Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle)));
}
if (captcha::check('contact')) {
//check if user is loged in
if (Auth::instance()->logged_in()) {
$email_from = $this->user->email;
$name_from = $this->user->name;
} else {
$email_from = core::post('email');
$name_from = core::post('name');
}
//akismet spam filter
if (!core::akismet($name_from, $email_from, core::post('message'))) {
if (core::config('general.messaging')) {
//price?
$price = (core::post('price') !== NULL and is_numeric(core::post('price'))) ? core::post('price') : NULL;
$ret = Model_Message::send_ad(core::post('message'), $this->user, $ad->id_ad, $price);
} else {
if (isset($_FILES['file'])) {
$file = $_FILES['file'];
} else {
$file = NULL;
}
//contact email is set use that one
if (isset($ad->cf_contactemail) and Valid::email($ad->cf_contactemail)) {
$to = $ad->cf_contactemail;
} else {
$to = NULL;
}
$ret = $user->email('user-contact', array('[EMAIL.BODY]' => core::post('message'), '[AD.NAME]' => $ad->title, '[EMAIL.SENDER]' => $name_from, '[EMAIL.FROM]' => $email_from, '[URL.AD]' => Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle))), $email_from, $name_from, $file, $to);
}
//if succesfully sent
if ($ret) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
// we are updating field of visit table (contact)
Model_Visit::contact_ad($ad->id_ad);
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
HTTP::redirect(Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle)));
} else {
Alert::set(Alert::SUCCESS, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('Captcha is not correct'));
HTTP::redirect(Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle)));
}
}
}
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:58,代码来源:contact.php
示例7: is_favorite
/**
* is favorite?
* @param Model_User $user user
* @param Model_Ad $ad ad
* @return boolean
*/
public static function is_favorite(Model_User $user, Model_Ad $ad)
{
if ($user->loaded() and $ad->loaded()) {
$fav = new Model_Favorite();
$fav->where('id_user', '=', $user->id_user)->where('id_ad', '=', $ad->id_ad)->find();
if ($fav->loaded()) {
return TRUE;
}
}
return FALSE;
}
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:17,代码来源:favorite.php
示例8: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$ad = new Model_Ad();
$user_ads = clone $ad;
//get current ad do not filter by user since admin also can see
$ad->where('seotitle', '=', Request::current()->param('seotitle'))->limit(1)->find();
if ($ad->loaded() and Auth::instance()->logged_in()) {
$user = Auth::instance()->get_user();
if ($user->id_role == Model_Role::ROLE_ADMIN or $user->id_user == $ad->id_user) {
$this->ad = $ad;
$this->user_ads = $user_ads->where('id_user', '=', $ad->id_user)->find_all();
}
}
}
开发者ID:zhangkom,项目名称:openclassifieds2,代码行数:20,代码来源:tools.php
示例9: action_create
public function action_create()
{
try {
if (!is_numeric(core::request('id_ad')) or !is_numeric(core::request('id_product')) or !is_numeric(core::request('id_user'))) {
$this->_error(__('Missing parameters'), 501);
} else {
$user = new Model_User(core::request('id_user'));
$ad = new Model_Ad(core::request('id_ad'));
if ($user->loaded() and $ad->loaded()) {
$id_product = core::request('id_product');
$amount = core::request('amount');
//in case not set by request
if (!is_numeric($amount)) {
//get original price for the product
switch ($id_product) {
case Model_Order::PRODUCT_CATEGORY:
$amount = $ad->category->price;
break;
case Model_Order::PRODUCT_TO_TOP:
$amount = core::config('payment.pay_to_go_on_top');
break;
case Model_Order::PRODUCT_TO_FEATURED:
$amount = Model_Order::get_featured_price(core::request('featured_days'));
break;
case Model_Order::PRODUCT_AD_SELL:
$amount = $ad->price;
break;
default:
$plan = new Model_Plan($id_product);
$amount = $plan->loaded() ? $plan->price : 0;
break;
}
}
$order = Model_Order::new_order($ad, $user, $id_product, $amount, core::request('currency'), Model_Order::product_desc(core::request('id_product')), core::request('featured_days'));
$order->confirm_payment(core::request('paymethod', 'API'), core::request('txn_id'));
$order->save();
$this->rest_output(array('order' => self::get_order_array($order)));
} else {
$this->_error(__('User or Ad not loaded'), 501);
}
}
} catch (Kohana_HTTP_Exception $khe) {
$this->_error($khe);
}
}
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:45,代码来源:orders.php
示例10: action_index
public function action_index()
{
$this->before('/pages/maps');
$this->template->title = __('Map');
$this->template->height = Core::get('height', '100%');
$this->template->width = Core::get('width', '100%');
$this->template->zoom = Core::get('zoom', core::config('advertisement.map_zoom'));
$this->template->height_thumb = Core::config('image.height_thumb') / 4;
$this->template->width_thumb = Core::config('image.width_thumb') / 4;
if (Model_User::get_userlatlng()) {
$this->template->center_lon = $_COOKIE['mylng'];
$this->template->center_lat = $_COOKIE['mylat'];
} else {
$this->template->center_lon = Core::get('lon', core::config('advertisement.center_lon'));
$this->template->center_lat = Core::get('lat', core::config('advertisement.center_lat'));
}
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('address', 'IS NOT', NULL)->where('latitude', 'IS NOT', NULL)->where('longitude', 'IS NOT', NULL);
//filter by category
if (core::get('category') !== NULL) {
$category = new Model_Category();
$category->where('seoname', '=', core::get('category'))->cached()->limit(1)->find();
if ($category->loaded()) {
$ads->where('id_category', 'IN', $category->get_siblings_ids());
}
}
//filter by location
if (core::get('location') !== NULL) {
$location = new Model_location();
$location->where('seoname', '=', core::get('location'))->cached()->limit(1)->find();
if ($location->loaded()) {
$ads->where('id_location', 'IN', $location->get_siblings_ids());
}
}
//if ad have passed expiration time dont show
if (core::config('advertisement.expire_date') > 0) {
$ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', Date::unix2mysql());
}
//if only 1 ad
if (is_numeric(core::get('id_ad'))) {
$ads = $ads->where('id_ad', '=', core::get('id_ad'));
}
$ads = $ads->order_by('published', 'desc')->limit(Core::config('advertisement.map_elements'))->find_all();
$this->template->ads = $ads;
}
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:45,代码来源:map.php
示例11: action_index
public function action_index()
{
if (core::config('general.auto_locate')) {
Theme::$scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7';
Theme::$scripts['footer'][] = '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js';
}
//template header
$this->template->title = '';
// $this->template->meta_keywords = 'keywords';
if (core::config('general.site_description') != '') {
$this->template->meta_description = core::config('general.site_description');
} else {
$this->template->meta_description = core::config('general.site_name') . ' ' . __('official homepage, get your post listed now.');
}
//setting main view/template and render pages
// swith to decide on ads_in_home
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
$ads_in_home = core::config('advertisement.ads_in_home');
//in case we do not count visits we cant show popular
if (core::config('advertisement.count_visits') == 0 and $ads_in_home == 2) {
$ads_in_home = 0;
}
switch ($ads_in_home) {
case 2:
$id_ads = array_keys(Model_Visit::popular_ads());
if (count($id_ads) > 0) {
$ads->where('id_ad', 'IN', $id_ads);
}
break;
case 1:
$ads->where('featured', 'IS NOT', NULL)->where('featured', '>=', Date::unix2mysql())->order_by('featured', 'desc');
break;
case 4:
$ads->where('featured', 'IS NOT', NULL)->where('featured', '>=', Date::unix2mysql())->order_by(DB::expr('RAND()'));
break;
case 0:
default:
$ads->order_by('published', 'desc');
break;
}
//if ad have passed expiration time dont show
if (core::config('advertisement.expire_date') > 0) {
$ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', Date::unix2mysql());
}
$ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all();
$categs = Model_Category::get_category_count();
$locats = Model_Location::get_location_count();
$auto_locats = NULL;
if (core::config('general.auto_locate') and Model_User::get_userlatlng()) {
$auto_locats = new Model_Location();
$auto_locats = $auto_locats->select(array(DB::expr('degrees(acos(sin(radians(' . $_COOKIE['mylat'] . ')) * sin(radians(`latitude`)) + cos(radians(' . $_COOKIE['mylat'] . ')) * cos(radians(`latitude`)) * cos(radians(abs(' . $_COOKIE['mylng'] . ' - `longitude`))))) * 111.321'), 'distance'))->where('latitude', 'IS NOT', NULL)->where('longitude', 'IS NOT', NULL)->having('distance', '<=', '100')->order_by('distance', 'desc')->find_all()->as_array();
}
$this->template->bind('content', $content);
$this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs, 'locats' => $locats, 'auto_locats' => $auto_locats));
}
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:56,代码来源:home.php
示例12: action_user_contact
public function action_user_contact()
{
$ad = new Model_Ad($this->request->param('id'));
//message to user
if ($ad->loaded() and $this->request->post()) {
$user = new Model_User($ad->id_user);
if (captcha::check('contact')) {
//akismet spam filter
if (!core::akismet(core::post('name'), core::post('email'), core::post('message'))) {
if (isset($_FILES['file'])) {
$file = $_FILES['file'];
} else {
$file = NULL;
}
$ret = $user->email('user.contact', array('[EMAIL.BODY]' => core::post('message'), '[AD.NAME]' => $ad->title, '[EMAIL.SENDER]' => core::post('name'), '[EMAIL.FROM]' => core::post('email')), core::post('email'), core::post('name'), $file);
//if succesfully sent
if ($ret) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
// we are updating field of visit table (contact)
$visit_contact_obj = new Model_Visit();
$visit_contact_obj->where('id_ad', '=', $this->request->param('id'))->order_by('created', 'desc')->limit(1)->find();
try {
$visit_contact_obj->contacted = 1;
$visit_contact_obj->save();
} catch (Exception $e) {
//throw 500
throw new HTTP_Exception_500($e->getMessage());
}
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
Request::current()->redirect(Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle)));
} else {
Alert::set(Alert::SUCCESS, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('You made some mistake'));
}
}
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:40,代码来源:contact.php
示例13: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
//if ad have passed expiration time dont show
if (core::config('advertisement.expire_date') > 0) {
$ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', Date::unix2mysql());
}
switch ($this->ads_type) {
case 'popular':
$id_ads = array_keys(Model_Visit::popular_ads());
if (count($id_ads) > 0) {
$ads->where('id_ad', 'IN', $id_ads);
}
break;
case 'featured':
$ads->where('featured', 'IS NOT', NULL)->where('featured', '>', Date::unix2mysql())->order_by('featured', 'desc');
break;
case 'latest':
default:
$ads->order_by('published', 'desc');
break;
}
$ads = $ads->limit($this->ads_limit)->cached()->find_all();
//die(print_r($ads));
$this->ads = $ads;
}
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:33,代码来源:ads.php
示例14: action_get
public function action_get()
{
try {
if (is_numeric($id_ad = $this->request->param('id'))) {
$ad = new Model_Ad();
//get distance to the ad
if (isset($this->_params['latitude']) and isset($this->_params['longitude'])) {
$ad->select(array(DB::expr('degrees(acos(sin(radians(' . $this->_params['latitude'] . ')) * sin(radians(`latitude`)) + cos(radians(' . $this->_params['latitude'] . ')) * cos(radians(`latitude`)) * cos(radians(abs(' . $this->_params['longitude'] . ' - `longitude`))))) * 69.172'), 'distance'));
}
$ad->where('id_ad', '=', $id_ad)->where('status', '=', Model_Ad::STATUS_PUBLISHED)->cached()->find();
if ($ad->loaded()) {
$a = $ad->as_array();
$a['price'] = i18n::money_format($ad->price);
$a['images'] = array_values($ad->get_images());
$a['category'] = $ad->category->as_array();
$a['location'] = $ad->location->as_array();
$a['user'] = Controller_Api_Users::get_user_array($ad->user);
$a['customfields'] = Model_Field::get_by_category($ad->id_category);
//sorting by distance, lets add it!
if (isset($ad->distance)) {
$a['distance'] = i18n::format_measurement($ad->distance);
}
$a['url'] = Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle));
$this->rest_output(array('ad' => $a));
} else {
$this->_error(__('Advertisement not found'), 404);
}
} else {
$this->_error(__('Advertisement not found'), 404);
}
} catch (Kohana_HTTP_Exception $khe) {
$this->_error($khe);
return;
}
}
开发者ID:vericoms,项目名称:openclassifieds2,代码行数:35,代码来源:listings.php
示例15: action_index
public function action_index()
{
//template header
$this->template->title = '';
// $this->template->meta_keywords = 'keywords';
$this->template->meta_description = Core::config('general.site_description');
//setting main view/template and render pages
// swith to decide on ads_in_home
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
switch (core::config('advertisement.ads_in_home')) {
case 2:
$id_ads = array_keys(Model_Visit::popular_ads());
if (count($id_ads) > 0) {
$ads->where('id_ad', 'IN', $id_ads);
}
break;
case 1:
$ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc');
break;
case 0:
default:
$ads->order_by('published', 'desc');
break;
}
//if ad have passed expiration time dont show
if (core::config('advertisement.expire_date') > 0) {
$ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', DB::expr('NOW()'));
}
$ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all();
$this->ads = $ads;
$categs = Model_Category::get_category_count();
$this->template->bind('content', $content);
$this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs));
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:35,代码来源:home.php
示例16: current
/**
* returns the current location
* @return Model_Location
*/
public static function current()
{
//we don't have so let's retrieve
if (self::$_current === NULL) {
self::$_current = new self();
if (Model_Ad::current() != NULL and Model_Ad::current()->loaded() and Model_Ad::current()->location->loaded()) {
self::$_current = Model_Ad::current()->location;
} elseif (Request::current()->param('location') != NULL || Request::current()->param('location') != URL::title(__('all'))) {
self::$_current = self::$_current->where('seoname', '=', Request::current()->param('location'))->limit(1)->cached()->find();
}
}
return self::$_current;
}
开发者ID:EmmanuelSimond,项目名称:openclassifieds2,代码行数:17,代码来源:location.php
示例17: action_info
public function action_info()
{
//try to get the info from the cache
$info = Core::cache('action_info', NULL);
//not cached :(
if ($info === NULL) {
$ads = new Model_Ad();
$total_ads = $ads->count_all();
$last_ad = $ads->select('published')->order_by('published', 'desc')->limit(1)->find();
$last_ad = $last_ad->published;
$ads = new Model_Ad();
$first_ad = $ads->select('published')->order_by('published', 'asc')->limit(1)->find();
$first_ad = $first_ad->published;
$views = new Model_Visit();
$total_views = $views->count_all();
$users = new Model_User();
$total_users = $users->count_all();
$info = array('site_url' => Core::config('general.base_url'), 'site_name' => Core::config('general.site_name'), 'site_description' => Core::config('general.site_description'), 'created' => $first_ad, 'updated' => $last_ad, 'email' => Core::config('email.notify_email'), 'version' => Core::VERSION, 'theme' => Core::config('appearance.theme'), 'theme_mobile' => Core::config('appearance.theme_mobile'), 'charset' => Kohana::$charset, 'timezone' => Core::config('i18n.timezone'), 'locale' => Core::config('i18n.locale'), 'currency' => '', 'ads' => $total_ads, 'views' => $total_views, 'users' => $total_users);
Core::cache('action_info', $info);
}
$this->response->headers('Content-type', 'application/javascript');
$this->response->body(json_encode($info));
}
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:23,代码来源:feed.php
示例18: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$ads = new Model_Ad();
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
switch ($this->ads_type) {
case 'popular':
$id_ads = array_keys(Model_Visit::popular_ads());
if (count($id_ads) > 0) {
$ads->where('id_ad', 'IN', $id_ads);
}
break;
case 'featured':
$ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc');
break;
case 'latest':
default:
$ads->order_by('published', 'desc');
break;
}
$ads = $ads->limit($this->ads_limit)->cached()->find_all();
//die(print_r($ads));
$this->ads = $ads;
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:29,代码来源:ads.php
示例19: adAction
/**
* 广告支付
*/
public function adAction()
{
// 判断广告主是否已登录
$aCurrUser = $this->getCurrUser(Model_User::TYPE_AD);
if (empty($aCurrUser)) {
return $this->showMsg('请先登录', false);
}
$iAdID = intval($this->getParam('id'));
$aAd = Model_Ad::getDetail($iAdID);
if (empty($aAd)) {
return $this->showMsg('推广计划不存在', false);
}
if ($aAd['iPayStatus'] == 1) {
return $this->showMsg('该推广计划已付款', false);
}
$paypass = $this->getParam('paypass');
$usmoney = intval($this->getParam('usmoney'));
$paytype = $this->getParam('paytype');
$aUser = Model_User::getDetail($aCurrUser['iUserID']);
$iPayMoney = $aAd['iTotalMoney'];
if ($usmoney == 1) {
if ($aUser['sPayPass'] != Model_User::makePassword($paypass)) {
return $this->showMsg('支付密码错误', false);
}
if ($aUser['iMoney'] >= $iPayMoney) {
$iPayID = Model_Finance::payAd($aUser, $aAd, 0);
if ($iPayID == 0) {
return $this->showMsg('支付失败,请稍后再试', false);
}
$iPayMoney = 0;
} else {
$iPayMoney = $iPayMoney - $aUser['iMoney'];
}
}
if ($iPayMoney == 0) {
return $this->showMsg('/payment/pay/success/id/' . $iPayID . '.html', 1);
}
$aParam = array('orderid' => Model_Finance::ORDER_AD . $iAdID, 'subject' => '51wom', 'body' => '在线支付', 'total_fee' => $iPayMoney);
switch ($paytype) {
case 'alipay':
return $this->showMsg('/payment/alipay/pay.html?' . http_build_query($aParam), 2);
break;
case 'weixin':
return $this->showMsg('/payment/weixin/pay.html?' . http_build_query($aParam), 3);
break;
}
return false;
}
开发者ID:pancke,项目名称:yyaf,代码行数:51,代码来源:Pay.php
示例20: action_home
public function action_home()
{
$ads = Model_Ad::search(array('search_string' => arr::get($_GET, 's'), 'limit' => $this->config['feed']['limit'], 'telecommute' => arr::get($_GET, 'telecommute'), 'jobtype_id' => arr::get($_GET, 'jobtype_id'), 'category_id' => arr::get($_GET, 'category_id'), 'fields' => array('id', 'title', 'telecommute', 'jobtype_id', 'company_name', 'highlight', 'location', 'created_at', 'description', 'jobboard_id')));
// Formats some field for better viewing
foreach ($ads['rows'] as $key => $ad) {
$ads['rows'][$key]['link'] = $ads['rows'][$key]['url'];
$ads['rows'][$key]['title'] = HTML::chars($ads['rows'][$key]['title'], true);
$ads['rows'][$key]['description'] = HTML::chars($ads['rows'][$key]['description'], true);
unset($ads['rows'][$key]['url']);
}
// Sets thje info text for the RSS feed
$info = array('title' => arr::get($_GET, 's') . 'Gowork@: IT Jobs board', 'link' => arr::get($_SERVER, 'SCRIPT_NAME'), 'description' => 'Recent Jobs posted', 'language' => 'en-US', 'generator' => '', 'ttl' => 60);
$content = Kohana_Feed::create($info, $ads['rows']);
header('Content-Type: text/xml');
echo $content;
die;
}
开发者ID:hbarroso,项目名称:Goworkat,代码行数:17,代码来源:feed.php
注:本文中的Model_Ad类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论