本文整理汇总了PHP中Listing类的典型用法代码示例。如果您正苦于以下问题:PHP Listing类的具体用法?PHP Listing怎么用?PHP Listing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Listing类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create
/**
* {@inheritdoc}
*/
public function create(Listing $listing)
{
$page = $listing->page();
$pages = $listing->pagesCount();
$links = ['prev' => null, 'next' => null, 'current' => $listing->page(), 'pages' => []];
if (!$pages) {
return $links;
}
if ($page > 1) {
$links['prev'] = $listing->getPageUrl($page - 1);
}
if ($page < $pages) {
$links['next'] = $listing->getPageUrl($page + 1);
}
// first and last always
$links['pages'][1] = $listing->getPageUrl(1);
$from = max($page - $this->back - 1, 2);
$to = min($page + $this->forward + 1, $pages - 1);
for ($i = $from; $i <= $to; $i++) {
if ($i != 2 && $i != $pages - 1 && ($i == $page - $this->back - 1 || $i == $page + $this->forward + 1)) {
// placeholders
$links['pages'][$i] = null;
} else {
$links['pages'][$i] = $listing->getPageUrl($i);
}
}
$links['pages'][$pages] = $listing->getPageUrl($pages);
return $links;
}
开发者ID:minchal,项目名称:vero,代码行数:32,代码来源:SimplePager.php
示例2: parse
/**
* Parse input into nodes
*
* @param net.daringfireball.markdown.Input $lines
* @return net.daringfireball.markdown.Node
*/
public function parse($lines)
{
$empty = false;
$target = null;
$result = new Listing($this->type);
while ($lines->hasMoreLines()) {
$line = $lines->nextLine();
// An empty line makes the list use paragraphs, except if it's the last line.
if (0 === $line->length()) {
$empty = true;
continue;
}
// Indented elements form additional paragpraphs inside list items. If
// the line doesn't start with a list bullet, this means the list is at
// its end.
if (preg_match('/^(\\s+)?([+*-]+|[0-9]+\\.) /', $line, $m) && !preg_match('/^(\\* ?){3,}$/', $line)) {
$empty && ($result->paragraphs = true);
$empty = false;
// Check whether we need to indent / dedent the list level, or whether
// the list item belongs to this list
$level = strlen($m[1]) / 2;
if ($level > $this->level) {
$lines->resetLine($line);
$target = $target ?: $result->add(new ListItem($result))->add(new Paragraph());
$target->add($this->enter(new self($this->type, $level))->parse($lines));
} else {
if ($level < $this->level) {
$lines->resetLine($line);
break;
} else {
$target = $result->add(new ListItem($result))->add(new Paragraph());
$line->forward(strlen($m[0]));
$this->tokenize($line, $target);
}
}
} else {
if (' ' === substr($line, 0, 2)) {
// Add paragraph to existing list item
$paragraph = $result->last()->add(new Paragraph());
$line->forward(2);
$this->tokenize($line, $paragraph);
} else {
$lines->resetLine($line);
break;
}
}
}
return $result;
}
开发者ID:xp-forge,项目名称:markdown,代码行数:55,代码来源:ListContext.class.php
示例3: action_delete
public function action_delete($id)
{
if (Session::has('id')) {
$account = Account::find(Session::get('id'));
$location = Location::find($id);
$owner = Account::find($location->account_id);
if ($account->id == $owner->id) {
$listings = Listing::where_location_id($location->id);
// foreach($listings as $listing)
// {
// $images = Image::where_listing_id($listing->id);
// foreach($images as $image)
// {
// $image->delete();
// }
// $listing->delete();
// }
$location->delete();
return Redirect::to('/account/myLocations/');
} else {
return Redirect::to('/');
}
} else {
return Redirect::to('/');
}
}
开发者ID:angmark0309,项目名称:remarket,代码行数:26,代码来源:location.php
示例4: run
public function run()
{
$box = Pages::getPageById(PAGE_PROPERTY_BOX);
$model = new ProEnquiryProperty();
$mListing = Listing::model()->findByPk($this->property_id);
// echo $mListing->property_name_or_address;die;
Listing::ReplaceContentCmsPage($box, $mListing);
$model->country_id = ActiveRecord::getDefaultAreaCode();
if (isset(Yii::app()->user->id)) {
$model->name = Yii::app()->user->title . ' ' . Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name;
$model->email = Yii::app()->user->email;
if (Yii::app()->user->role_id != ROLE_REGISTER_MEMBER) {
$model->email = Yii::app()->user->email_not_login;
}
$model->phone = Yii::app()->user->phone;
$model->country_id = Yii::app()->user->country;
}
$this->dir = Yii::getPathOfAlias('application.components.views') . '/_agent_detail.php';
$model->description = trim(strip_tags($box->content));
if ($this->position == "bottom") {
$this->render("enquiry_bottom", array('model' => $model, 'box' => $box, 'property_id' => $this->property_id, 'agent_id' => $this->agent_id, 'dir' => $this->dir, 'position' => 'bottom'));
} else {
$this->render("enquiry_right", array('model' => $model, 'box' => $box, 'property_id' => $this->property_id, 'agent_id' => $this->agent_id, 'dir' => $this->dir, 'position' => 'right'));
}
}
开发者ID:jasonhai,项目名称:onehome,代码行数:25,代码来源:EnquiryProperty.php
示例5: show
/**
* Display the specified resource.
*
* @param string $location
* @return Response
*/
public function show()
{
$location = Input::get('location');
$type = strtolower(Input::get('type'));
$wildcardLocation = "%" . $location . "%";
if (Input::has('type')) {
$types = array('meeting-room', 'coworking', 'desk');
if (!in_array($type, $types, true)) {
return Redirect::to('/')->with('flash_message_404', "Sorry, we don't have that type of space so we brought you back home!");
}
$listings = Listing::with('thumbnail')->where('isPublic', '=', 1, "and")->where('space_type', '=', $type)->where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->orWhere('postcode', 'LIKE', $wildcardLocation)->get();
} else {
$listings = Listing::with('thumbnail')->where('isPublic', '=', 1, "and")->where('space_type', '=', $type)->where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->orWhere('postcode', 'LIKE', $wildcardLocation)->get();
}
$colNum = Listing::where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->where('isPublic', '=', '1')->count();
switch ($colNum) {
case 1:
$colNum = 12;
break;
case 2:
$colNum = 6;
break;
case 3:
$colNum = 3;
break;
}
$title = ucwords("Search: " . $type . " spaces in " . $location);
return View::make('search.results')->with('listings', $listings)->with('title', $title)->with('colNum', $colNum);
}
开发者ID:s-matic,项目名称:collab-consumption,代码行数:35,代码来源:SearchController.php
示例6: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Listing::create([]);
}
}
开发者ID:remix101,项目名称:compex,代码行数:7,代码来源:ListingsTableSeeder.php
示例7: getListingCount
public function getListingCount()
{
$criteria = new CDbCriteria();
$criteria->compare('user_id', $this->id);
$criteria->compare('status', STATUS_ACTIVE);
$criteria->compare('status_listing', STATUS_LISTING_ACTIVE);
return Listing::model()->count($criteria);
}
开发者ID:jasonhai,项目名称:onehome,代码行数:8,代码来源:ProAgent.php
示例8: down
/**
* Revert the changes to the database.
*
* @return void
*/
public function down()
{
//
$listings = Listing::all();
foreach ($listings as $listing) {
$listing->delete();
}
}
开发者ID:angmark0309,项目名称:remarket,代码行数:13,代码来源:2013_02_27_213554_insert_listings.php
示例9: sort_link
function sort_link($link_order, $text, $order, $cur_page, $direction, $default_direction)
{
/*
*
*<th><a class="sorting" href='<?= $base_url ?><?= $cur_page ?>/name/<?= Listing::reverse_direction($order == 'name' ? $direction : $default_direction) ?>'>Name</a></th>
*/
return anchor($base_url . $cur_page . "/" . $order . "/" . Listing::reverse_direction($order == $link_order ? $direction : $default_direction), $text);
}
开发者ID:ram-izaap,项目名称:got-safety,代码行数:8,代码来源:sort_helper.php
示例10: run
public function run()
{
$listingInfo = Listing::model()->findByPk($this->listing_id);
if ($listingInfo) {
$this->listing_title = $listingInfo->property_name_or_address;
}
$model = $this->searchReleatedListing();
$this->render("listing_releated_page_thank_you/index", array('model' => $model));
}
开发者ID:jasonhai,项目名称:onehome,代码行数:9,代码来源:ListingReleatedOnPageThankYouWidget.php
示例11: action_index
public function action_index()
{
$users_files = Listing::get_list();
$users_files = array_diff($users_files, array('.', '..'));
if (isset($_SESSION['user'])) {
include_once dir . '/view/list.php';
} else {
header('Location: /');
}
return true;
}
开发者ID:Gr1n4,项目名称:file-sharing.ru,代码行数:11,代码来源:List_controller.php
示例12: actionSearch
public function actionSearch($searchtext = '')
{
if ($searchtext == '') {
$this->actionIndex(0);
return;
}
$categories = array();
$listings = Listing::model()->searchFrontendListings($searchtext);
ViewsTrack::addCategoryView(0);
$this->render('index', array('categories' => $categories, 'listings' => $listings));
}
开发者ID:yasirgit,项目名称:hotmall,代码行数:11,代码来源:SiteController.php
示例13: actionCompanyListingMoveto
/**
* @Author: ANH DUNG Aug 05, 2014
* @Todo: CompanyEditContact at grid
* @Param: $id list id 1,2,3 ...
*/
public function actionCompanyListingMoveto($id)
{
try {
$id = $this->FormatListId($id);
$company_listing_type = $_GET['company_listing_type'];
Listing::ChangeTypeByListId($id, $company_listing_type);
} catch (Exception $ex) {
echo $exc->getMessage();
die;
}
}
开发者ID:jasonhai,项目名称:onehome,代码行数:16,代码来源:AjaxController.php
示例14: up
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
//
$listings = Listing::all();
foreach ($listings as $l) {
for ($i = 0; $i < 5; $i++) {
$image = new Image();
$image->description = "PIC DESCRIPTIOIN";
$image->listing_id = $l->id;
$image->save();
}
}
}
开发者ID:angmark0309,项目名称:remarket,代码行数:18,代码来源:2013_03_13_232334_insert_pics.php
示例15: action_delete
public function action_delete()
{
if (Session::has('id') && Auth::check() && Input::has('file') && Input::has('listing_id')) {
$account = Account::find(Session::get('id'));
$listing = Listing::find(Input::get('listing_id'));
$location = Location::find($listing->location_id);
if ($account->id == $location->account_id) {
unlink(Input::get('file'));
} else {
die("Image does not belogn to user");
}
}
}
开发者ID:angmark0309,项目名称:remarket,代码行数:13,代码来源:image.php
示例16: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store($id)
{
$listing = Listing::where('isPublic', '=', 1)->where('id', '=', $id)->first();
if (!$listing) {
throw new \Symfony\Component\Routing\Exception\ResourceNotFoundException();
}
$input = Input::all();
//return print_r($input,true);
$yesterday = \Carbon\Carbon::now('Australia/Sydney');
$yesterday = $yesterday->format('Y-m-d H:i:s');
// return $yesterday;
$rules = array('comments' => array('required', 'min:3'), 'user_phone' => array('required', 'min:9', 'max:30'), 'request_start_datetime' => array('required', 'date', 'dateformat: Y-m-d H:i:s', 'before: ' . $input['request_end_datetime']), 'request_end_datetime' => array('required', 'date', 'dateformat: Y-m-d H:i:s', 'after: ' . $yesterday));
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return Redirect::back()->withInput($input)->withErrors($validator);
}
$comments = $this->sanitizeStringAndParseMarkdown($input['comments']);
$authuser = Auth::user();
$name = $authuser->name;
$bookings = new Booking();
$bookings->user_id = $authuser->id;
$bookings->user_name = $name;
$bookings->listing_id = $id;
$bookings->user_phone = $input['user_phone'];
$bookings->request_start_datetime = $input['request_start_datetime'];
$bookings->request_end_datetime = $input['request_end_datetime'];
$bookings->status = "Booking request submitted. Awaiting Open Source Collaborative Consumption Marketplace review.";
$bookings->user_comments = $comments;
$bookings->space_owner_id = $listing->owner_id;
$address = $listing->address1 . ", " . $listing->suburb . ", " . $listing->city . " " . $listing->country;
$data = $input;
$data['address'] = $address;
$data['title'] = $listing->title;
$data['id'] = $id;
$data['type'] = $listing->space_type;
$data['user_name'] = $name;
$data['status'] = $bookings->status;
/* TODO: Make it email the user and space owner */
Mail::send("booking.mail.newbookingfounders", $data, function ($message) {
$message->to('[email protected]')->subject('New booking on Open Source Collaborative Consumption Marketplace');
});
$email = Auth::user()->email;
Mail::send("booking.mail.newbookinguser", $data, function ($message) use($email) {
$message->to($email)->subject('Your new booking on Open Source Collaborative Consumption Marketplace!');
});
$bookings->save();
return Redirect::to('dashboard')->with('flash_message_good', "Your booking has been sent. We'll be in touch soon with confirmation or questions!");
}
开发者ID:s-matic,项目名称:collab-consumption,代码行数:53,代码来源:BookingController.php
示例17: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($id)
{
if (!empty($id) && !Yii::app()->user->isGuest) {
$user_email = Yii::app()->user->name;
$userModel = User::model()->findByAttributes(array('user_email' => $user_email));
$listingId = $id;
$listingModel = Listing::model()->findByPk($listingId);
$model = new Booking();
$model->booking_listing_id = $listingModel->listing_id;
$model->booking_user_id = $userModel->user_id;
$model->booking_amount = $listingModel->listing_price;
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->booking_id));
}
} else {
echo "Booking failed";
}
}
开发者ID:pmswamy,项目名称:training1demo,代码行数:22,代码来源:BookingController.php
示例18: CHttpException
$model = ListingCompany::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
public function actionFieldClick($id, $field)
{
$model = Listing::model()->findByPk($id);
if (!$model || !in_array($field, array('owner_contact'))) {
throw new CHttpException(403, 'Permission denied.');
}
$lc = ListingClick::model()->findByAttributes(array('listing_id' => $id, 'user_id' => Yii::app()->user->id, 'field' => $field));
if (!$lc) {
$lc = new ListingClick();
$lc->listing_id = $id;
$lc->user_id = Yii::app()->user->id;
$lc->field = $field;
$lc->save();
开发者ID:jasonhai,项目名称:onehome,代码行数:19,代码来源:CompanyController.php
示例19: action_index
public function action_index()
{
if (Auth::check()) {
if (Session::has('id')) {
if (Session::get('admin') == 1) {
$listings_count = Listing::count();
$successes = 0;
$money = 0;
$survey_results = Surveyresult::all();
foreach ($survey_results as $result) {
$money += $result->monetary_value;
$successes += $result->exchange_success;
}
$view = View::make('statistics.index')->with('title', 'Current Stats')->with('listings_count', $listings_count)->with('successes', $successes)->with('money', $money);
return $view;
}
}
}
return Redirect::to('/');
}
开发者ID:angmark0309,项目名称:remarket,代码行数:20,代码来源:statistics.php
示例20: actionSearch
public function actionSearch()
{
$this->checkRequest();
$q = $this->q;
$this->checkRequiredParams($q, array('token', 'user_id', 'status', 'type', 'page'));
$this->checkToken();
//same as login session
$criteria = new CDbCriteria();
$criteria->compare('user_id', $q->user_id);
$criteria->compare('status_listing', $q->status);
$criteria->compare('listing_type', $q->type);
$criteria->limit = 20;
$criteria->order = 'property_name_or_address ASC';
$models = Listing::model()->findAll($criteria);
$items = array();
foreach ($models as $model) {
$items[] = array('property_name_or_address' => $model->property_name_or_address, 'tenure' => Listing::getViewDetailTenure($model));
}
$result = ApiModule::$defaultSuccessResponse;
$result['list'] = $items;
$result['message'] = Yii::t('systemmsg', 'Query success');
//always need
ApiModule::sendResponse($result);
}
开发者ID:jasonhai,项目名称:onehome,代码行数:24,代码来源:ListingsController.php
注:本文中的Listing类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论