本文整理汇总了PHP中elem函数的典型用法代码示例。如果您正苦于以下问题:PHP elem函数的具体用法?PHP elem怎么用?PHP elem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadTab
function loadTab($tabname)
{
global $str;
$tab_cfg = $this->getTabCfg($tabname);
if (!$tab_cfg) {
return false;
}
if ($tab_cfg['type'] == 'elem') {
$elem = $tab_cfg['conf']['elem'];
list(, $tmp) = explode('_', $elem);
include_once elem($this->submodule . '/' . $elem);
$class_name = 'T' . ucfirst($tmp) . 'Element';
$this->elem_object =& Registry::get($class_name);
$this->elem_object->id = get('id', 0, 'pg');
$this->elem_object->page = get('page', 0, 'pg');
$this->elem_object->esId = get('esId', 0, 'pg');
$this->elem_object->tab = get('tab', 'tab_', 'pg');
$this->elem_object->name = $this->submodule;
//$this->elem_object->frame = get('frame', 'cnt', 'pg');
$this->elem_object->ElemInit();
if (!empty($this->elem_object->str)) {
$str[get_class_name($this)] = array_merge($str[get_class_name($this)], $this->elem_object->str);
}
}
}
示例2: td
public function td($row)
{
/**
* @var FileModel $file
*/
$file = $row;
return elem('td', null, '' . elem('span', array('class' => format_file_glyphicon($file)), true) . ' ' . elem('a', array('href' => $this->link($file)), htmlspecialchars($this->field($file))));
}
示例3: webvideo_render_object
function webvideo_render_object($args)
{
$obj = $args['obj'];
if (!isset($obj['type']) || $obj['type'] != 'webvideo') {
return false;
}
$e = elem('div');
elem_attr($e, 'id', $obj['name']);
elem_add_class($e, 'webvideo');
elem_add_class($e, 'resizable');
elem_add_class($e, 'object');
// hooks
invoke_hook_first('alter_render_early', 'webvideo', array('obj' => $obj, 'elem' => &$e, 'edit' => $args['edit']));
$html = elem_finalize($e);
invoke_hook_last('alter_render_late', 'webvideo', array('obj' => $obj, 'html' => &$html, 'elem' => $e, 'edit' => $args['edit']));
return $html;
}
示例4: inc
function inc($name)
{
$ret = module($name, false);
if (!$ret) {
$ret = elem($name, false);
}
if (!$ret) {
$ret = elem_inc($name, false);
}
if (!$ret) {
$ret = core($name, false);
}
if (!$ret) {
$ret = base($name);
}
return $ret;
}
示例5: td
public function td($row)
{
return elem('td', null, htmlspecialchars($this->format($this->field($row))));
}
示例6: download_render_object
function download_render_object($args)
{
$obj = $args['obj'];
if (!isset($obj['type']) || $obj['type'] != 'download') {
return false;
}
$e = elem('div');
elem_attr($e, 'id', $obj['name']);
elem_add_class($e, 'download');
elem_add_class($e, 'object');
// hooks
invoke_hook_first('alter_render_early', 'download', array('obj' => $obj, 'elem' => &$e, 'edit' => $args['edit']));
$html = elem_finalize($e);
invoke_hook_last('alter_render_late', 'download', array('obj' => $obj, 'html' => &$html, 'elem' => $e, 'edit' => $args['edit']));
if (!$args['edit']) {
// put link to file around the element
if (SHORT_URLS) {
$link = base_url() . urlencode($obj['name']) . '&download=1';
} else {
$link = base_url() . '?' . urlencode($obj['name']) . '&download=1';
}
$html = '<a href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '">' . "\n\t" . str_replace("\n", "\n\t", $html) . "\n" . '</a>' . "\n";
}
return $html;
}
示例7: array_merge
<?php
/**
* @var $param
*/
$a = array_merge(array('html' => '<p>Hello</p>', 'page' => basename($_SERVER['PHP_SELF'])), $param);
$page = $a['page'];
$html = $a['html'];
$li = function ($active, $page, $title) {
echo elem('li', array('class' => $page == $active ? 'active' : false), elem('a', array('href' => $page), htmlspecialchars($title), $page == $active ? ' <span class="sr-only">(current)</span>' : null));
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A Template For a Single Page Application | templ_php_spa</title>
<link href="static/bower_components/bootstrap/dist/css/bootstrap.css" type="text/css" rel="stylesheet">
<link href="static/css/bootstrap.css" type="text/css" rel="stylesheet">
<!--
<link href="//bootswatch.com/darkly/bootstrap.min.css" type="text/css" rel="stylesheet">
-->
<link href="//bootswatch.com/slate/bootstrap.min.css" type="text/css" rel="stylesheet">
<link href="static/css/sm.css" type="text/css" rel="stylesheet">
<style>
pre {
color: white;
border: 1px solid rgba(0,0,0,0.6);
background: #313539;
示例8: foreach
foreach ($movie->director() as $person) {
$people .= ";" . $person['name'];
}
if (!empty($people)) {
$xml .= elem('director', substr($people, 1));
}
$people = '';
foreach ($movie->cast() as $person) {
$people .= ";" . $person['name'];
}
if (!empty($people)) {
$xml .= elem('actor', substr($people, 1));
}
$genres = '';
foreach ($movie->genres() as $genre) {
$genres .= ";{$genre}";
}
if (!empty($genres)) {
$xml .= elem('genre', substr($genres, 1));
}
if (($photo_url = $movie->photo_localurl()) != FALSE) {
$xml .= " <cover>{$photo_url}</cover>\n";
}
$budg = new imdb_budget($imdbid);
$xml .= elem('budget', $budg->budget());
$xml .= " </movie>\n";
}
file_put_contents($resultfile, $xml . "</imdbdata>\n");
######################################################################
# EOF
######################################################################
示例9: elem
<?php
require_once elem('realty/objects/objects_elem_func');
class TAddressElement extends TCommonObjectElement
{
//---------------------------------------------------------------------------------
var $elem_name = "elem_address";
var $elem_table = "objects";
var $elem_type = "single";
//пол¤ дл¤ выборки из базы элема
var $elem_fields = array('columns' => array('city' => array('type' => 'text', 'size' => '50'), 'district_id' => array('type' => 'select', 'func' => 'getDistricts'), 'metro_id' => array('type' => 'select', 'func' => 'getMetroList'), 'metro_dest_value' => array('type' => 'text'), 'metro_dest_text' => array('type' => 'select', 'func' => 'getMetroDest')), 'id_field' => 'id');
var $sql = false;
var $elem_where = "";
var $elem_req_fields = array();
var $script = "";
//---------------------------------------------------------------------------------
function ElemInit()
{
$this->elem_str['metro_dest_value'] = array('”даленность от метро (минут)', 'Distance from metro');
$this->elem_str['metro_dest_text'] = array('”даленность от метро (способ)', 'Distance from metro');
parent::ElemInit();
}
function getMetroDest()
{
global $settings;
return $settings['metro_dest'];
}
function getMetroList()
{
return sql_getRows('SELECT id, name FROM obj_locat_metrostations ORDER BY id', true);
}
示例10: elem
<?php
require_once elem('objects/elem_contacts');
class TContactsElement extends TContactsElement_Base
{
}
示例11: td
public function td($row)
{
return elem('td', array('style' => 'width: 1px'), elem('span', array('class' => format_file_glyphicon($row)), true));
}
示例12: elem
<?php
require_once elem('objects/elem_text');
class TtextElement extends TtextElement_Base
{
}
示例13: elem
<?php
require_once elem('objects/elem_google');
class TGoogleElement extends TGoogleElement_Base
{
}
示例14: elem
<?php
require_once elem('objects/elem_plan');
class TPlanElement extends TPlanElement_Base
{
}
示例15: editLoadPrice
function editLoadPrice()
{
$file = $_POST['file'];
if (substr($file, 0, 5) == '@temp') {
$file = substr($file, 5);
}
$type = substr($file, strrpos($file, '.') + 1);
if ($type != 'csv') {
return "<script>alert('Расширение файла не поддерживается');</script>";
}
echo "<script>parent.stopLoad();parent.hideDownloadFrom();</script>";
flush();
$GLOBALS['gzip'] = false;
set_time_limit(0);
ob_end_clean();
if (!is_readable($file)) {
$this->eRror = "Не могу открыть файл для чтения.";
return "<script>parent.document.getElementById('error').innnerHTML = '" . $this->eRror . "';</script>";
}
require elem('csv_tools/Bs_CsvUtil.class.php');
$Bs_CsvUtil = new Bs_CsvUtil();
$data = $Bs_CsvUtil->csvFileToArray($file, ';', 'both', FALSE, FALSE, TRUE);
if (empty($data)) {
$this->eRror = "Полученный файл пуст.";
return "<script>parent.document.getElementById('error').innnerHTML = '" . $this->eRror . "';</script>";
}
foreach ($data as $i => $trow) {
if ($i == 0 && $trow[0] == 'c_id') {
continue;
}
$row['c_id'] = $trow[0];
if (empty($row['c_id'])) {
continue;
}
if (strlen($row['c_id']) < 8) {
$row['c_id'] = str_pad($row['c_id'], 8 - strlen($row['c_id']), "0", STR_PAD_LEFT);
}
$trow[1] = str_replace(array(" ", chr(160)), "", $trow[1]);
$trow[1] = str_replace(",", ".", $trow[1]);
$row['price'] = $trow[1];
$trow[2] = str_replace(array(" ", chr(160)), "", $trow[2]);
$trow[2] = str_replace(",", ".", $trow[2]);
$row['old_price'] = $trow[2];
// Если в базе нет строки с данным c_id, то выдаем ошибку
$_id = sql_getValue('SELECT id FROM ' . $this->table . ' WHERE c_id=' . $row['c_id']);
if (!$_id) {
$this->eRror = 'Запись с c_id=' . $row['c_id'] . ' не существует в базе данных!';
} else {
$sql = 'UPDATE ' . $this->table . ' SET price = "' . $row['price'] . '", old_price = "' . $row['old_price'] . '" WHERE c_id = "' . $row['c_id'] . '"';
sql_query($sql);
$this->eRror = sql_getError();
}
if ($this->eRror) {
$this->errors[$i] = e($this->eRror);
}
echo 'Обработана строка № ' . $i . "\r\n";
flush();
}
//---------------------
$str = "<script>";
$str .= "parent.document.getElementById('error').innerHTML = 'Загрузка завершена.<br>';";
if ($this->errors) {
$err_str = '';
foreach ($this->errors as $k => $err) {
$err_str .= 'Строка ' . $k . ': ' . $err . '<br>';
}
$str .= "parent.document.getElementById('error').innerHTML += '" . $err_str . "';";
}
$str .= "</script>";
return $str;
}