本文整理汇总了PHP中SiteHelper::subject_content方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelper::subject_content方法的具体用法?PHP SiteHelper::subject_content怎么用?PHP SiteHelper::subject_content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteHelper
的用法示例。
在下文中一共展示了SiteHelper::subject_content方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
echo $form->textField($model, 'image_url', array('size' => 80, 'maxlength' => 250));
?>
<?php
echo $form->error($model, 'image_url');
?>
</div>
<?php
if ($this->action->id == 'update') {
?>
<div class="row">
<?php
echo $form->labelEx($model, 'Content');
?>
<?php
echo SiteHelper::subject_content($model);
?>
</div>
<?php
}
?>
<div class="row">
<?php
echo $form->labelEx($model, 'text');
?>
<?php
echo $form->textArea($model, 'text', array('rows' => 6, 'cols' => 50));
?>
<?php
echo $form->error($model, 'text');
?>
示例2:
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'Content');
?>
<?php
echo SiteHelper::subject_content($model);
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'Content code');
?>
<?php
echo CHtml::encode(SiteHelper::subject_content($model));
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'user_country_id');
?>
<?php
echo CHtml::encode($model->user_country->name);
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'user_comment');
?>
<?php
示例3:
?>
</a>
</div>
<div class="row">
<?php
echo $data->country->name . " | ";
?>
<?php
echo CHtml::encode(date("Y/m/d H:i", $data->time_submitted) . " UTC");
?>
</div>
<div class="row">
<?php
echo SiteHelper::subject_content($data);
?>
</div>
<div class="row">
<?php
echo SiteHelper::formatted($data->user_comment);
?>
</div>
<div class="row">
<?php
echo SiteHelper::share_links($data->urn, $data->title);
?>
</div>
示例4: getLiveData
/**
* Gets the latest live data about the current and next subject to be live
*
*
*/
public function getLiveData($subject_id = 0, $comment_id, $width = 0, $height = 0, $keepratio = true)
{
$arr_data = array();
$arr_comments = array();
$arr_data['new_comment'] = 0;
$arr_data['new_sub'] = 0;
//TODO: Store the whole subject record and its content as an array on the live_subject table
$live_subject = Yii::app()->db->createCommand()->select('*')->from('live_subject')->queryRow();
//returns an array, not an object
$arr_data['subject_id'] = $live_subject['subject_id'];
$arr_data['comment_id'] = $live_subject['comment_id'];
//If the subject cached on client's device its the same that the live_subject table indicates to be cached...
if ($subject_id != $live_subject['subject_id']) {
$subject_data = unserialize($live_subject['subject_data']);
$arr_data['title'] = $subject_data->title;
$arr_data['content_type_id'] = $subject_data->content_type_id;
$arr_data['content_type'] = strtolower($subject_data->content_type->name);
$arr_data['priority'] = strtolower($subject_data->priority_type->name);
$country = Country::model()->findByPk($subject_data->country_id);
$arr_data['country_code'] = $country->code ? $country->code : 'WW';
$arr_data['country_name'] = $country->name ? $country->name : 'WORLD';
$user = User::model()->findByPk($subject_data->user_id);
$arr_data['username'] = $user->username;
$arr_data['user_firstname'] = $user->firstname;
$arr_data['user_lastname'] = $user->lastname;
$arr_data['user_image'] = $user->getUserImage("small_");
$arr_data['content_html'] = SiteHelper::subject_content($subject_data);
$arr_data['content_data'] = (array) Subject::subject_content($subject_data)->getAttributes();
if ($arr_data['content_type'] == 'image') {
$img_name = $arr_data['content_data']['id'] . "." . $arr_data['content_data']['extension'];
$url_base = Yii::app()->getRequest()->getBaseUrl(true) . '/' . $arr_data['content_data']['path'] . '/';
if ($width or $height) {
$new_img_name = SiteLibrary::get_image_resized($img_name, Yii::app()->params['webdir'] . DIRECTORY_SEPARATOR . $arr_data['content_data']['path'], $width, $height, $keepratio);
if ($new_img_name) {
$arr_data['content_data']['image_url'] = $url_base . $new_img_name;
} else {
$arr_data['content_data']['image_url'] = $url_base . $img_name;
}
} else {
$arr_data['content_data']['image_url'] = $url_base . $img_name;
}
}
$arr_data['user_comment'] = SiteHelper::formatted($subject_data->user_comment);
$arr_data['time_submitted'] = $subject_data->time_submitted;
$arr_data['display_time'] = $subject_data->show_time;
$arr_data['scheduled_time'] = $subject_data->position;
if ($subject_id != $live_subject['subject_id']) {
$arr_data['new_sub']++;
}
$arr_data['likes'] = $subject_data->likes;
$arr_data['dislikes'] = $subject_data->dislikes;
$arr_data['urn'] = $subject_data->urn;
$arr_data['permalink'] = Yii::app()->getRequest()->getBaseUrl(true) . "/sub/" . $subject_data->urn;
//Send the last two previous subjects
$last_subs = Yii::app()->db->createCommand()->select('*')->from('subject')->where('show_time>:show_time AND id <>:id1', array(':show_time' => 0, ':id1' => $live_subject['subject_id']))->order('show_time DESC')->limit(5)->queryAll();
$arr_data['last_sub_title'] = $last_subs[0]['title'];
$arr_data['last_sub_2_title'] = $last_subs[1]['title'];
$arr_data['last_sub_urn'] = $last_subs[0]['urn'];
$arr_data['last_sub_2_urn'] = $last_subs[1]['urn'];
}
//Search comments
if ($subject_id != $live_subject['subject_id']) {
$comment_id = 0;
}
$live_comments = Yii::app()->db->createCommand()->select('*')->from('live_comment')->where('comment_id > :comment_id AND subject_id = :subject_id', array(':comment_id' => $comment_id, ':subject_id' => $live_subject['subject_id']))->order('comment_id ASC')->queryAll();
foreach ($live_comments as $live_comment) {
$arr_data['new_comment']++;
$arr_data['comment_id'] = $live_comment['comment_id'];
$user = User::model()->find('username=:username', array(':username' => $live_comment['username']));
$arr_comments[] = array('comment_id' => $live_comment['comment_id'], 'username' => $live_comment['username'], 'user_firstname' => $user->firstname, 'user_lastname' => $user->lastname, 'user_image' => $user->getUserImage("small_"), 'comment_text' => CHtml::encode($live_comment['comment_text']), 'comment_number' => $live_comment['comment_number'], 'comment_time' => date("H:i:s", $live_comment['comment_time']), 'comment_country' => $live_comment['comment_country'], 'likes' => $live_comment['likes'], 'dislikes' => $live_comment['dislikes']);
}
$arr_data['comments'] = $arr_comments;
//Add user session information
if (!$subject_id and !Yii::app()->user->isGuest) {
$arr_data['session_userid'] = Yii::app()->user->id;
$arr_data['session_username'] = Yii::app()->user->name;
$session_user = User::model()->findByPk((int) Yii::app()->user->id);
$arr_data['session_userimage'] = $session_user->getUserImage("small_");
}
//Set times
$utc_time = SiteLibrary::utc_time();
$arr_data['current_time'] = $utc_time;
$arr_data['current_time_h'] = date("H", $utc_time);
$arr_data['current_time_m'] = date("i", $utc_time);
$arr_data['current_time_s'] = date("s", $utc_time);
$arr_data['time_remaining'] = $live_subject['scheduled_time'] + Yii::app()->params['subject_interval'] * 60 - $utc_time + 2;
//lets give some seconds rage in case cron gets delayed
return $arr_data;
}