本文整理汇总了PHP中Tree::getInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getInfo方法的具体用法?PHP Tree::getInfo怎么用?PHP Tree::getInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::getInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public static function send($id)
{
foreach ($_POST as $key => $value) {
$_POST[$key] = htmlspecialchars(trim(strip_tags($value)));
}
if ($_SESSION['captcha_keystring'] == $_POST['kcaptcha'] && $_SESSION['captcha_keystring'] != '') {
$text = '';
foreach ($_POST as $name => $item) {
if ($_POST[$name . '_text'] && strpos($name, '_text') === false) {
if (strpos($name, '_area') !== false) {
$text .= '<b>' . $_POST[$name . '_text'] . ':</b> <br />' . nl2br($item) . '<br />';
} else {
$text .= '<b>' . $_POST[$name . '_text'] . ':</b> ' . $item . '<br />';
}
}
}
$mail = new Email();
$info = Tree::getInfo($id);
if (Funcs::$conf['mail'][$info['path']]) {
$mail->To(Funcs::$conf['mail'][$info['path']]);
} elseif (Funcs::$conf['settings']['email']) {
$mail->To(Funcs::$conf['settings']['email']);
} else {
return false;
}
$mail->Subject($_POST['subject'] . ' на сайте ' . $_SERVER['HTTP_HOST']);
$mail->Text($text);
$mail->Send();
return true;
} else {
return false;
}
}
示例2: Report
public static function Report()
{
$sql = 'SELECT * FROM {{orders}} WHERE loyalty=1 AND sent=0';
$list = DB::getAll($sql);
foreach ($list as $order) {
$sql = '
SELECT * FROM {{orders_items}}
WHERE orders=' . $order['id'] . '
';
$items = DB::getAll($sql);
$data = $order;
foreach ($items as $item) {
$temp = Tree::getInfo($item['tree']);
if ($temp['path'] != 'catalogopt') {
$data['list'][] = Catalog::getOne($item['tree']);
}
}
$text = View::getRenderEmpty('email/report', $data);
$mail = new Email();
$mail->Text($text);
$mail->Subject('Оставьте отзыв о товаре на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
$mail->To($order['email']);
$mail->Send();
$sql = '
UPDATE {{orders}}
SET sent=1
WHERE id=' . $order['id'] . '
';
DB::exec($sql);
}
}
示例3: getBranch
public static function getBranch($tree)
{
foreach ($tree as $item) {
$info = Tree::getInfo($item['id']);
if ($info['type'] == 'cat') {
Prepare::$tree[] = $item;
}
Prepare::getBranch($item['sub']);
}
}
示例4: getList
function getList()
{
$data = array();
$xml = Sitemap::getSitemapXML();
//$site=Control::getSite(Funcs::$siteDB);
$sql = 'SELECT * FROM {{tree}} WHERE visible=1 ORDER BY mdate DESC, cdate DESC';
$list = DB::getAll($sql);
foreach ($list as $item) {
$info = Tree::getInfo($item['id']);
if ($info['id2'] != 0 && $info['params'] != '') {
$path = 'http://' . $_SERVER['HTTP_HOST'] . Tree::getPathToTree($item['id'], $info['params']);
} else {
$path = 'http://' . $_SERVER['HTTP_HOST'] . Tree::getPathToTree($item['id']);
}
$data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $path, 'mdate' => date('Y-m-d', strtotime($item['mdate'])), 'changefreq' => $xml[str_replace('/', '_', $path)]['changefreq'], 'priority' => $xml[str_replace('/', '_', $path)]['priority'], 'checked' => is_array($xml[str_replace('/', '_', $path)]) ? 'checked' : '');
}
return $data;
}
示例5: getResult
public function getResult()
{
$data = array();
$q = trim(strip_tags($_GET['q']));
if ($q) {
$sql = '
SELECT * FROM {{search}}
INNER JOIN {{tree}} ON {{search}}.tree={{tree}}.id
WHERE search LIKE \'%' . $q . '%\' AND visible=1
ORDER BY {{search}}.cdate DESC
';
$list = DB::getAll($sql);
foreach ($list as $item) {
$fields = Fields::getFieldsByTree($item['tree'], 'gal');
$path = Tree::getPathToTree($item['tree']);
$data[] = array('id' => $item['tree'], 'name' => $item['name'], 'path' => $path, 'fields' => $fields, 'info' => Tree::getInfo($item['tree']));
}
}
return $data;
}
示例6: getMarket
public static function getMarket($id)
{
$data = array();
$tree = Tree::getInfo($id);
if (strpos($tree['modul2'], 'catalog') !== 'false') {
$sql = 'SHOW COLUMNS FROM {{catalog}}';
$cols = DB::getAll($sql);
$x = 0;
foreach ($cols as $item) {
if ($item['Field'] == 'market') {
$x = 1;
}
}
if ($x) {
$ids = Tree::getChilds($id);
$ids[] = $id;
$sql = '
SELECT COUNT(*) FROM {{catalog}}
WHERE tree IN (' . implode(',', $ids) . ') AND market=1
';
$m1 = DB::getOne($sql);
$sql = '
SELECT COUNT(*) FROM {{catalog}}
WHERE tree IN (' . implode(',', $ids) . ') AND market=0
';
$m2 = DB::getOne($sql);
if ($m1 >= $m2) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
}
return 0;
}
示例7: getTreeselect
public function getTreeselect($id, $treeId, $path)
{
$data = array();
$tree = array();
$module = Tree::getInfo($treeId);
$sql = '
SELECT * FROM {{fields}}
WHERE module=' . $module['id'] . ' AND path=\'' . $path . '\'
';
$field = DB::getRow($sql);
$data['name'] = $field['name'];
$data['params'] = $field['params'];
$params = explode('-', $data['params']);
$module = Module::getModuleByPath($params[0]);
if (count($params) == 2) {
$sql = '
SELECT * FROM {{' . $params[0] . '}}
ORDER BY num
';
} else {
$sql = 'SELECT id FROM {{' . $params[0] . '}} WHERE path=\'' . $params[1] . '\'';
$parent = DB::getOne($sql);
if ($parent) {
$sql = '
SELECT * FROM {{' . $params[0] . '}}
WHERE parent=' . $parent . ' ORDER BY num
';
}
}
$list = DB::getAll($sql);
$left = 0;
foreach ($list as $item) {
$item['value'] = $item['id'];
if ($id) {
$sql = 'SELECT \'checked\' FROM {{relations}} WHERE modul1=\'data\' AND modul2=\'' . $params[0] . '\' AND id1=' . $id . ' AND id2=' . $item['id'] . '';
$item['checked'] = DB::getOne($sql);
}
$item['sub'] = Fields::getTreeselectBranch($item['id'], $params, $id);
$item['admin'] = Fields::getTreeselectAdminField($item['id']);
$tree[] = $item;
}
$data['list'] = $tree;
return $data;
}
示例8: addTree
public function addTree($parent, $tree, $module = '')
{
$path = $tree['path'];
if ($path == '') {
$path = $tree['name'];
}
$path = Funcs::Transliterate($path);
if ($tree['seo_title'] == '') {
$tree['seo_title'] = $tree['name'];
}
if ($tree['seo_keywords'] == '') {
$tree['seo_keywords'] = $tree['name'];
}
if ($tree['seo_description'] == '') {
$tree['seo_description'] = $tree['name'];
}
$udate = $tree['udate'];
if (trim($udate) == '') {
$udate = date("d.m.Y H:i:00");
}
$sql = '
INSERT INTO {{tree}}
SET
parent=' . $parent . ',
name=\'' . $tree['name'] . '\',
path=\'' . $path . '\',
seo_title=\'' . $tree['seo_title'] . '\',
seo_keywords=\'' . $tree['seo_keywords'] . '\',
seo_description=\'' . $tree['seo_description'] . '\',
udate=\'' . date('Y-m-d H:i:s', strtotime($udate)) . '\',
cdate=NOW(),
visible=' . ($tree['visible'] == '' ? '0' : '1') . ',
menu=0,
site=' . $_SESSION['site'] . '
';
$id = DB::exec($sql);
if ($module) {
$tree['info']['path'] = $module;
} else {
$tree['info'] = Tree::getInfo($parent);
}
$sql = '
INSERT INTO {{relations}}
SET
modul1=\'tree\',
modul2=\'' . $tree['info']['path'] . '\',
id1=\'' . $id . '\',
id2=1,
cdate=NOW()
';
DB::exec($sql);
//Tree::saveSearch($id);
return $id;
}