本文整理汇总了PHP中Chtml::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Chtml::tag方法的具体用法?PHP Chtml::tag怎么用?PHP Chtml::tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chtml
的用法示例。
在下文中一共展示了Chtml::tag方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transform
public function transform($output)
{
// toc process
$toc = '';
$output = parent::transform($output);
if (preg_match_all('/<h2(?: id=".+")?>(.+?)<\\/h2>/', $output, $match, PREG_PATTERN_ORDER) > 1) {
$toc = CHtml::openTag('div', array('class' => 'toc')) . CHtml::openTag('ol');
for ($i = 0; $i < count($match[0]); $i++) {
$text = $i + 1 . '. ' . $match[1][$i] . CHtml::link('¶', null, array('name' => 'ch' . $i, 'class' => 'anchor'));
$html = CHtml::tag('h2', array('id' => 'ch' . $i), $text);
$toc .= Chtml::tag('li', array(), CHtml::link($match[1][$i], '#ch' . $i));
$output = str_replace($match[0][$i], $html, $output);
}
$toc .= CHtml::closeTag('ol') . CHtml::closeTag('div');
}
// image process
$output = preg_replace_callback('#<img\\s+src=".+?"\\s+alt="(.+?)"(?:\\s+title="(.+?)")?\\s+/>#s', array(&$this, '_doImages_callback_format'), $output);
return $toc . $output;
}
示例2: actionGetClasses
public function actionGetClasses()
{
if (!isset($_POST['major_id'])) {
return;
}
$major_id = $_POST['major_id'];
$classes = Major::model()->findByPk($major_id)->classes;
$classes = CHtml::listData($classes, 'class_id', 'class_name');
$htmlData = CHtml::tag('option', array('selected' => 'selected', 'value' => ''), '请选择班级');
foreach ($classes as $value => $key) {
$htmlData .= Chtml::tag('option', array('value' => $value), Chtml::encode($key));
}
echo json_encode(array('htmlData' => $htmlData));
}
示例3: renderInfo
public function renderInfo($name, array $metaData, $form = null)
{
$value = isset($metaData['content']) ? $metaData['content'] : '';
if (is_array($value)) {
throw new CException('wrong type' . $name);
}
$htmlOptions = $this->htmlOptions($metaData);
return Chtml::tag('div', $htmlOptions, $value);
}
示例4: renderHtml
public function renderHtml($name, array $metaData, $form = null)
{
$out = '';
$id = $name;
$value = isset($metaData['current']) ? $metaData['current'] : '';
$metaData['class'][] = 'htmleditor';
$readOnly = isset($metaData['readOnly']) ? $metaData['readOnly'] : false;
if (isset($metaData['label'])) {
$out .= CHtml::label($metaData['label'], $id, $metaData['labelOptions']);
}
$out .= Chtml::tag('div', array('class' => implode(' ', $metaData['class'])), CHtml::textArea($id, $value, array('id' => $id, 'form' => $form, 'readonly' => $readOnly)));
return $out;
}
示例5: actionGetDorms
public function actionGetDorms()
{
if (!isset($_POST['building_id'])) {
return;
}
$building_id = $_POST['building_id'];
$dorms = Building::model()->findByPk($building_id)->dorms;
$dorms = CHtml::listData($dorms, 'dorm_id', 'dorm_name');
$htmlData = CHtml::tag('option', array('selected' => 'selected', 'value' => ''), '请选择宿舍');
foreach ($dorms as $value => $key) {
$htmlData .= Chtml::tag('option', array('value' => $value), Chtml::encode($key));
}
echo json_encode(array('htmlData' => $htmlData));
}
示例6: renderItems
/**
* Renders widget items.
*/
public function renderItems()
{
$items = array();
foreach ($this->items as $item) {
$items[] = $this->renderItem($item);
}
return \Chtml::tag('ul', $this->options, implode("\n", $items));
}
示例7: actionGetBuildings
public function actionGetBuildings()
{
if (!isset($_POST['area_id'])) {
return;
}
$area_id = $_POST['area_id'];
$buildings = CampusArea::model()->findByPk($area_id)->buildings;
$buildings = CHtml::listData($buildings, 'building_id', 'building_id');
$htmlData = CHtml::tag('option', array('selected' => 'selected', 'value' => ''), '请选择楼栋');
foreach ($buildings as $value => $key) {
$htmlData .= Chtml::tag('option', array('value' => $value), Chtml::encode($key . '号'));
}
echo json_encode(array('htmlData' => $htmlData));
}
示例8: actionMatkul
public function actionMatkul()
{
$data = Kurikulum::model()->findAll('ID_KUR=:id', array(':id' => (int) $_POST['Jadwal']['ID_KUR']));
$return = CHtml::listData($data, 'KODE_MK', 'KODE_MK');
foreach ($return as $value => $KODE_MK) {
echo Chtml::tag('option', array('value' => $value), CHtml::encode($KODE_MK), true);
}
echo Chtml::tag('option', array('value' => 'Kosong1'), CHtml::encode('Free'));
}
示例9: renderHtml
public function renderHtml($name, array $metaData, $form = null)
{
$out = '';
$id = $name;
$value = isset($metaData['current']) ? $metaData['current'] : '';
$metaData['class'][] = 'htmleditor';
$readOnly = isset($metaData['readOnly']) ? $metaData['readOnly'] : false;
if (isset($metaData['label'])) {
$out .= CHtml::label($metaData['label'], $id, $metaData['labelOptions']);
}
$out .= Chtml::tag('div', array('class' => implode(' ', $metaData['class'])), $this->widget('bootstrap.widgets.TbHtml5Editor', array('name' => $id, 'value' => $value, 'width' => '100%', 'editorOptions' => array('html' => true)), true));
return $out;
}
示例10: actionMatkuljadwal
public function actionMatkuljadwal($kbk)
{
$id_kur = (int) $_POST['MJadwal']['ID_KUR'];
$kuliah = CHtml::listData(Kurikulum::model()->findAll(array('condition' => "ID_KUR = '{$id_kur}' AND (KBK_ID LIKE '{$kbk}' OR KBK_ID LIKE 'all')")), 'KODE_MK', 'KODE_MK');
// $kurikulum = Kurikulum::model()->findAllByAttributes(array('ID_KUR' => $id_kur));
// $data = Kurikulum::model()->findAll(
// "ID_KUR=:id ", array(':id' => (int) $_POST['MJadwal']['ID_KUR']));
// $return = CHtml::listData($kuliah, 'KODE_MK', 'KODE_MK');
foreach ($kuliah as $value => $KODE_MK) {
echo Chtml::tag('option', array('value' => $value), CHtml::encode($KODE_MK), true);
}
echo Chtml::tag('option', array('value' => 'Kosong'), CHtml::encode('Free'));
}
示例11: htmlListFromQueryAll
private function htmlListFromQueryAll($aStrings, $htmlOptions = array())
{
$sHtmlList = array();
if (!empty($aStrings)) {
foreach ($aStrings as $aString) {
# if(is_string($aString))
# $sHtmlList[]=CHtml::tag("li",array(),$aString);
# else
$sHtmlList[] = CHtml::tag("li", array(), current($aString));
}
return Chtml::tag("ul", array('class' => 'kce-answerstext'), implode($sHtmlList, "\n"));
}
}
开发者ID:SondagesPro,项目名称:LS-AutoComment_IterativeQuestionnaire,代码行数:13,代码来源:autoCommentIterativeQuestionnaire.php