本文整理汇总了PHP中array_remove_value函数的典型用法代码示例。如果您正苦于以下问题:PHP array_remove_value函数的具体用法?PHP array_remove_value怎么用?PHP array_remove_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_remove_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delDefaultFor
public function delDefaultFor($d)
{
$def = $this->getDefaultFor();
array_remove_value($def, $d);
$this->setDefaultFor($def);
return $this;
}
示例2: createForm
public function createForm()
{
$form = new Am_Form_Admin();
$options = Am_Currency::getSupportedCurrencies();
array_remove_value($options, Am_Currency::getDefault());
$sel = $form->addSelect('currency', array('class' => 'am-combobox'))->setLabel(___('Currency'))->loadOptions($options)->addRule('required');
$date = $form->addDate('date')->setLabel(___('Date'))->addRule('required')->addRule('callback2', "--wrong date--", array($this, 'checkDate'));
$rate = $form->addText('rate', array('length' => 8))->setLabel(___("Exchange Rate\nenter cost of 1 (one) %s", Am_Currency::getDefault()))->addRule('required');
return $form;
}
示例3: show_help
/**
* show help on a page
*/
function show_help() {
if ( !empty($_POST['anchor']) and preg_match("/^[a-z]+$/", $_POST['anchor']) ) {
$identifier = BN."#".$_POST['anchor'];
} else {
$identifier = BN;
}
if (Login::$member) {
$hide = Login::$member->hide_help();
array_remove_value($hide, $identifier);
Login::$member->update_help($hide);
} else {
if (empty($_SESSION['show_help'])) {
$_SESSION['show_help'] = array($identifier);
} elseif (!in_array($identifier, $_SESSION['show_help'])) {
$_SESSION['show_help'][] = $identifier;
}
}
}
示例4: removeAutomaticallyRemovedPath
/**
* Removes the specified automatically-removed path.
*
* @param $path
*/
public function removeAutomaticallyRemovedPath($path)
{
array_remove_value($this->automaticallyRemovedPaths, $path);
$this->automaticallyRemovedPaths = array_values($this->automaticallyRemovedPaths);
}
示例5: ob_end_clean
ob_end_clean();
header("Location: ?page={$page}");
exit;
}
// uninstall
if ($act == "uninstall") {
$plug = $_GET['plugin'];
if ($_POST['yes']) {
// if it's active
if (in_array($plug, unserialize($set->sinfo->active_plugins))) {
// we deactivate
$active_plugins = unserialize($set->sinfo->active_plugins);
if (!is_array($active_plugins)) {
$active_plugins = array();
}
$active_plugins = array_remove_value($active_plugins, $plug);
$db->query("UPDATE `" . MAI_PREFIX . "settings` SET `active_plugins` = '" . serialize(array_unique($active_plugins)) . "'");
if (is_callable($plug . "_deactivate")) {
call_user_func($plug . "_deactivate");
}
}
// we uninstall
if (is_callable($plug . "_uninstall")) {
call_user_func($plug . "_uninstall");
}
ob_end_clean();
header("Location: ?page={$page}");
exit;
} else {
$content = "<div class='content'>\n\t<form action='#' method='post'>\n\t{$lang->are_you_sure} <br/>\n\t<input type='submit' name='yes' value='{$lang->yes}'> <a href='?'>{$lang->cancel}</a>\n\t</form>\n\t</div>";
}
示例6: lib_getphotolist
/**
* 调用相册显示数据标签
*
* @version $Id: getphotolist.lib.php netman
* @package Stourweb.Taglib
* @copyright Copyright (c) 2007 - 2011, Stourweb, Inc.
* @link http://www.stourweb.com
*/
function lib_getphotolist(&$ctag, &$refObj)
{
global $dsql, $cfg_indexphoto;
include SLINEDATA . "/webinfo.php";
$attlist = "row|10,flag|,type|top,limit|0";
FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = trim($ctag->GetInnertext());
$basefield = 'a.aid,a.title,a.seotitle,a.litpic,a.content,a.title as littitle,a.alt,a.author,a.shownum,a.webid,a.headimgid';
$revalue = '';
//加目的地页面显示条件
$destwhere = isset($refObj->Fields['kindid']) ? "and FIND_IN_SET({$refObj->Fields['kindid']},kindlist) " : '';
//用于聚合页面
if ($type == 'mdd') {
if (isset($refObj->Fields['kindid'])) {
$sonid = $refObj->Fields['kindid'];
$number = isset($refObj->Fields['shownumber']) ? $refObj->Fields['shownumber'] : $row;
//如果模块设置了显示数量则使用.
$sql = "select {$basefield} from #@__photo as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=6) where FIND_IN_SET({$sonid},a.kindlist) order by c.isding desc,case when c.displayorder is null then 9999 end,c.displayorder asc,a.addtime desc limit {$limit},{$number}";
} else {
return '';
}
} else {
if ($type == 'sonhot') {
if (isset($refObj->Fields['kindid'])) {
$sonid = $refObj->Fields['kindid'];
$sql = "select {$basefield} from #@__photo a where FIND_IN_SET({$sonid},kindlist) order by shownum desc limit {$limit},{$row}";
} else {
return '';
}
} else {
if ($type == 'attr') {
if (isset($attrid)) {
$sql = "select {$basefield} from #@__photo a where FIND_IN_SET({$attrid},attrid) order by displayorder asc,shownum desc limit {$limit},{$row}";
} else {
return '';
}
} else {
if ($type == 'relative') {
$kindlist = $refObj->Fields['kindlist'];
$maxkindid = array_remove_value($kindlist);
//最后一级.
$where = " FIND_IN_SET({$maxkindid},kindlist) ";
$sql = "select {$basefield} from #@__photo a where {$where} order by modtime desc,addtime desc limit {$limit},{$row}";
} else {
if ($type == 'sonj') {
if (isset($refObj->Fields['sonid'])) {
$sonid = $refObj->Fields['sonid'];
$sql = "select aid,title,seoname,headimg,content,title as littitle,alt,author,shownum,webid,headimgid from #@__photo where webid!='' {$destwhere} and photokind={$sonid} order by modtime desc,addtime desc limit {$limit},{$row}";
} else {
return '';
}
} else {
if ($flag == 'recommend') {
$sql = "select {$basefield} ,b.isjian,b.isding ,b.displayorder from #@__photo a left join #@__allorderlist b on(a.id=b.aid and b.typeid=6) order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'isding') {
$sql = "select {$basefield} from #@__photo where webid={$sys_webid} and isding=1 order by addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'roll') {
//首页相册显示方式
if ($GLOBALS['cfg_indexphoto'] == "0") {
$sql = "select {$basefield} from #@__photo where webid={$sys_webid} order by modtime desc,addtime desc";
} else {
if ($GLOBALS['cfg_indexphoto'] == "-1") {
$sql = "select id,pictname as photoname,litpic as headimg,pid as aid from #@__photo_picture where webid={$sys_webid} order by modtime desc";
} else {
$sql = "select id,pictname as photoname,litpic as headimg,pid as aid from #@__photo_picture where webid={$sys_webid} and pid={$GLOBALS['cfg_indexphoto']} order by modtime desc";
}
}
} else {
return '';
}
}
}
}
}
}
}
}
$dsql->SetQuery($sql);
$dsql->Execute();
$ctp = new STTagParse();
$ctp->SetNameSpace("field", "[", "]");
$ctp->LoadSource($innertext);
$GLOBALS['autoindex'] = 0;
while ($row = $dsql->GetArray()) {
$GLOBALS['autoindex']++;
$weburl = GetWebURLByWebid($row['webid']);
$row['url'] = $weburl . "/photos/show_{$row['aid']}.html";
$row['title'] = !empty($row['seotitle']) ? $row['seotitle'] : $row['photoname'];
$row['litpic'] = !empty($row['litpic']) ? $row['litpic'] : getDefaultImage();
//.........这里部分代码省略.........
示例7: array_remove_value
function array_remove_value(&$arr, $var)
{
foreach ($arr as $key => $value) {
if (is_array($value)) {
array_remove_value($arr[$key], $var);
} else {
$value = trim($value);
if ($value == $var) {
unset($arr[$key]);
} else {
$arr[$key] = $value;
}
}
}
$tmp_arr = array();
foreach ($arr as $value) {
$tmp_arr[] = $value;
}
$arr = $tmp_arr;
unset($tmp_arr);
}
示例8: foreach
//编辑附加属性
$delmeta = $metavalue;
$idarr = $_POST["chk"];
if (count($idarr) > 0) {
foreach ($idarr as $id) {
$varid = $_POST["extid"];
$varname = $_POST["extname"];
$varvalue = $_POST["extvalue"];
if (is_numeric($id)) {
if ($metadata->ExistMetaName($posttype, $varname[$id], $aid)) {
$sql = "UPDATE yiqi_meta SET metaname = '" . $varname[$id] . "',metavalue = '" . $varvalue[$id] . "' where metaid = '" . $varid[$id] . "'";
} else {
$sql = "INSERT INTO yiqi_meta (metaid,metatype,objectid,metaname,metavalue) VALUES (NULL,'{$posttype}','{$aid}','" . $varname[$id] . "','" . $varvalue[$id] . "')";
}
$yiqi_db->query(CheckSql($sql));
$delmeta = array_remove_value($delmeta, $varname[$id]);
}
}
}
if (count($delmeta) > 0) {
foreach ($delmeta as $delmetainfo) {
if ($delmetainfo != '' && $delmetainfo != '-') {
$sql = "DELETE FROM yiqi_meta WHERE metaname = '{$delmetainfo}' and metatype = '{$posttype}' and objectid = '{$aid}'";
$yiqi_db->query(CheckSql($sql));
}
}
}
exit("文章修改成功!");
} else {
exit("文章修改失败,请与管理员联系!");
}
示例9: lib_getarclist
/**
* 调用文章显示数据标签
*
* @version $Id: getarclist.lib.php netman
* @package Stourweb.Taglib
* @copyright Copyright (c) 2007 - 2011, Stourweb, Inc.
* @link http://www.stourweb.com
*/
function lib_getarclist(&$ctag, &$refObj)
{
global $dsql;
include SLINEDATA . "/webinfo.php";
$attlist = "row|8,flag|,type|top,limit|0,haspic|,attrid|0,attrname|";
FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$webid = empty($sys_webid) ? 0 : $sys_webid;
$innertext = trim($ctag->GetInnertext());
$revalue = '';
$basefield = 'a.id,a.aid,a.webid,a.title,a.seotitle,a.shownum,a.content,a.addtime,a.webid,a.attrid,a.litpic as litpic,a.kindlist,a.author';
//是否有图片
$picwhere = !empty($haspic) ? " and (a.litpic is not null and a.litpic!='') and a.ishidden=0 " : '';
$picwhere2 = !empty($haspic) ? " where (a.litpic is not null and a.litpic!='') and a.ishidden=0 " : '';
if ($type == 'mdd') {
if ($flag == 'recommend') {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc';
} else {
if ($flag == 'hot') {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc';
} else {
if ($flag == 'new') {
$orderby = 'order by a.addtime desc';
} else {
if ($flag == 'imagehot') {
$orderby = " and a.litpic!='' order by case when c.displayorder is null then 9999 end,c.displayorder asc";
} else {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc';
}
}
}
}
$orderby .= ",a.modtime desc,a.addtime desc";
$sonid = isset($definekind) ? $definekind : $refObj->Fields['kindid'];
//这里增加子站的判断
if ($GLOBALS['sys_child_webid'] != 0) {
$dest_id = $GLOBALS['sys_child_webid'];
}
$sonid = $sonid ? $sonid : $dest_id;
if (isset($sonid)) {
$number = isset($refObj->Fields['shownumber']) ? $refObj->Fields['shownumber'] : $row;
//如果模块设置了显示数量则使用.
$where = " FIND_IN_SET({$sonid},a.kindlist) and a.ishidden=0 ";
$where .= !empty($haspic) ? " and a.litpic is not null" : '';
$sql = "select {$basefield} from #@__article as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=4) where {$where} {$orderby} limit {$limit},{$number}";
} else {
return '';
}
} else {
if ($type == 'theme') {
$themeid = $refObj->Fields['themeid'];
if (empty($themeid)) {
return '';
}
$sql = "select a.* from #@__article a where FIND_IN_SET({$themeid},a.themelist) {$picwhere} order by a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($type == 'pinlun') {
$sql = "select a.*,b.id as plid,b.memberid,b.content as plcontent,b.addtime as pltime from #@__article a inner join #@__comment b on (a.id = b.articleid) order by b.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'specical') {
$sql = "select {$basefield} from #@__article a where ishidden=0 and isindex =1 {$picwhere} order by modtime desc,addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'recommend') {
$sql = "select {$basefield},b.isjian,b.isding as isding,b.displayorder from #@__article a left join #@__allorderlist b on (a.id=b.aid and b.typeid=4) {$picwhere2} order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'kindrecommend') {
$kid = $refObj->Fields['kid'];
$sql = "select {$basefield} from #@__article a where a.ishidden=0 and FIND_IN_SET({$kid},a.kindlist) {$picwhere} order by a.displayorder asc, a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'isindex') {
$sql = "select {$basefield} from #@__article a where a.isindex=1 {$picwhere} order by a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'new') {
$sql = "select {$basefield} from #@__article a {$picwhere2} order by a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'hot') {
$sql = "select {$basefield} from #@__article a where a.webid IS NOT NULL {$picwhere} order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'photo') {
$sql = "select {$basefield} from #@__article a where webid IS NOT NULL and a.litpic !='' {$picwhere} order by a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'jieban') {
$getsql = "select id from #@__article_attr where aid=0 and webid=0";
$arr = $dsql->GetOne($getsql);
$jiebanid = $arr['id'];
//获取id
$sql = "select {$basefield},b.isding,b.displayorder,b.isjian from #@__article a left join #@__attrorderlist b on a.aid=b.aid and a.webid=b.webid where FIND_IN_SET({$jiebanid},a.attrid) {$picwhere} order by b.displayorder asc, a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'relative') {
$kindlist = $refObj->Fields['kindlist'];
$maxkindid = array_remove_value($kindlist);
//最后一级.
//.........这里部分代码省略.........
示例10: __unset
public function __unset($name)
{
unset($this->data[$name]);
if (array_key_exists('update', $this->query)) {
array_remove_value($this->query['update'], $name);
}
}
示例11: getAllIdents
/**
* Возвращает полный список сущностей, не проверяя права доступа
*/
public final function getAllIdents($includePattern = false)
{
if (!is_array($this->IDENTS)) {
$all = array_keys(FoldedStorage::getEntities($this->UNIQUE));
$this->IDENTS['full'] = $all;
$this->IDENTS['short'] = array_values(array_remove_value($all, self::PATTERN_NAME));
}
return $this->IDENTS[$includePattern ? 'full' : 'short'];
}
示例12: lib_getlinelist
function lib_getlinelist(&$ctag, &$refObj)
{
global $startcity;
global $dsql;
include SLINEDATA . "/webinfo.php";
$attlist = "row|8,flag|,type|top,sonid|,limit|0,";
FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$webid = 0;
$innertext = trim($ctag->GetInnertext());
$revalue = '';
$basefield = "a.aid,a.id,a.webid,a.title,a.seotitle,a.sellpoint,a.litpic,a.storeprice,a.price,a.linedate,a.features,a.transport,a.lineday,a.startcity,a.overcity,a.shownum,a.satisfyscore,a.bookcount,a.attrid,a.kindlist,a.color,a.iconlist";
if ($type == 'top' && empty($flag)) {
return '';
}
//如果调用二级栏目则必须在显示类里指定sonid
$limit = !empty($limit) ? $limit : 0;
if ($type == 'startcity') {
$sql = "select {$basefield} from #@__line as a left join #@__kindorderlist as c on (a.id=c.aid) where a.ishidden=0 and c.typeid=1 and startcity='{$startcity}' and c.classid={$sonid} and FIND_IN_SET({$sonid},a.kindlist) {$orderby} limit {$limit},{$row}";
}
if ($type == 'mdd') {
if ($flag == 'hot') {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc';
} else {
if ($flag == 'recommend') {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc';
} else {
if ($flag == 'specical') {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc ';
} else {
$orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc';
}
}
}
$sonid = isset($definekind) ? $definekind : $refObj->Fields['kindid'];
//这里增加子站的判断
if ($GLOBALS['sys_child_webid'] != 0) {
$dest_id = $GLOBALS['sys_child_webid'];
}
$sonid = $sonid ? $sonid : $dest_id;
$shownum = isset($row) ? $row : $refObj->Fields['shownum'];
$shownum = empty($shownum) ? 6 : $shownum;
if (isset($sonid)) {
$number = isset($refObj->Fields['shownumber']) ? $refObj->Fields['shownumber'] : $row;
//如果模块设置了显示数量则使用.
$sql = "select {$basefield},c.isjian,c.istejia,c.isding from #@__line as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=1) where a.ishidden=0 and FIND_IN_SET({$sonid},a.kindlist) {$orderby} limit {$limit},{$shownum}";
} else {
return '';
}
} else {
if ($type == 'searchrec') {
if ($GLOBALS['childid'] != 0) {
$kchild = $GLOBALS['childid'];
$sql = "select distinct {$basefield} from #@__line as a left join #@__kindorderlist as c on (c.classid={$kchild} and a.id=c.aid and c.typeid=1) where a.ishidden=0 and c.isjian=1 and FIND_IN_SET({$kchild},a.kindlist) order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc limit 0,4";
} else {
$sql = "select {$basefield} a from #@__line where a.ishidden=0 and a.isjian=1 order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
}
} else {
if ($type == 'destsearchrec') {
if ($GLOBALS['destid'] != 0) {
$kchild = $GLOBALS['destid'];
$sql = "select {$basefield} from #@__line as a left join #@__kindorderlist as c on (c.classid={$kchild} and a.id=c.aid and c.typeid=1) where a.ishidden=0 and FIND_IN_SET({$kchild},a.kindlist) {$orderby} limit 0,4";
} else {
$sql = "select {$basefield} from #@__line a where a.ishidden=0 and a.isjian=1 order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
}
} else {
if ($type == 'top') {
if ($flag == 'recommend') {
$sql = "select {$basefield},b.isding,b.istejia,b.displayorder from #@__line as a left join #@__allorderlist b on (a.id=b.aid and b.typeid=1) where a.ishidden=0 order by case when b.displayorder is null then 9999 end, b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'specical') {
$sql = "select {$basefield},b.isding,b.istejia,b.displayorder from #@__line as a left join #@__allorderlist b on (a.id=b.aid and b.typeid=1) where a.ishidden=0 order by b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'hot') {
$sql = "select {$basefield} from #@__line a where a.ishidden=0 order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'attribute') {
if (empty($attrid)) {
$attrid = $refObj->Fields['attrid'];
}
$sql = "select {$basefield} from #@__line a where FIND_IN_SET('{$attrid}',a.attrid) and a.ishidden=0 order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'relative') {
$kindlist = $refObj->Fields['kindlist'];
$maxkindid = array_remove_value($kindlist);
//最后一级.
$maxkindid = empty($maxkindid) ? $GLOBALS['dest_id'] : $maxkindid;
$maxkindid = empty($maxkindid) ? 0 : $maxkindid;
$where = " FIND_IN_SET({$maxkindid},a.kindlist) ";
$sql = "select {$basefield} from #@__line a where {$where} and a.ishidden=0 order by a.shownum desc,a.modtime desc,a.addtime desc limit 0,{$row}";
} else {
if ($flag == 'listexcept') {
$sql = "select aid from #@__line where isjian=1 and a.ishidden=0 order by isjian desc,displayorder asc limit 0,5";
$dsql->Execute("list", $sql);
$a = "";
while ($str = $dsql->GetArray("list")) {
$a .= $str["aid"] . ",";
}
$a = substr($a, 0, -1);
if (!$a == "") {
//.........这里部分代码省略.........
示例13: lib_gettuanlist
//.........这里部分代码省略.........
//如果模块设置了显示数量则使用.
$where = "a.ishidden=0 and FIND_IN_SET({$sonid},a.kindlist) and a.endtime>{$time} and a.starttime<={$time}";
$where .= !empty($haspic) ? " and a.litpic is not null" : '';
$sql = "select {$basefield} from #@__tuan as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=4) where {$where} {$orderby} limit {$limit},{$number}";
} else {
return '';
}
} else {
if ($type == 'daytime') {
if (!empty($day)) {
$day = date('Y-m-d', strtotime($day));
$day = strtotime($day);
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and starttime={$day} and endtime!='' order by a.addtime asc,a.endtime asc limit {$limit},{$row}";
} else {
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime>{$time} order by a.starttime asc,a.addtime desc limit {$limit},{$row}";
}
} else {
if ($flag == 'recommend') {
$sql = "select {$basefield},b.isjian,b.isding as isding,b.displayorder from #@__tuan a left join #@__allorderlist b on (a.id=b.aid and b.typeid=13) where a.ishidden=0 and a.endtime>{$time} order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'new') {
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'hot') {
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.shownum desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'byendtime') {
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.endtime asc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'photo') {
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and a.litpic !='' and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'nostart') {
$sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime>{$time} order by a.starttime asc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'relative') {
$kindlist = $refObj->Fields['kindlist'];
$maxkindid = get_exist_kind($kindlist);
//最后一级.
$maxkindid = empty($maxkindid) ? 0 : $maxkindid;
$where = " FIND_IN_SET({$maxkindid},a.kindlist) ";
//排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联
$sql = "select a.* from #@__tuan a where find_in_set('{$attrid}',a.attrid) where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row} ";
} else {
if ($type == 'theme') {
$themeid = $refObj->Fields['themeid'];
if (empty($themeid)) {
return '';
}
$sql = "select a.* from #@__tuan a where a.ishidden=0 and FIND_IN_SET({$themeid},a.themelist) and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
return '';
}
}
}
}
}
}
}
}
}
}
$dsql->SetQuery($sql);
$dsql->Execute();
$ctp = new STTagParse();
$ctp->SetNameSpace("field", "[", "]");
$ctp->LoadSource($innertext);
$GLOBALS['autoindex'] = 0;
while ($row = $dsql->GetArray()) {
$GLOBALS['autoindex']++;
$webroot = GetWebURLByWebid($row['webid']);
$sonid = $refObj->Fields['sonid'];
$row['url'] = $webroot . "/tuan/show_{$row['aid']}.html";
$row['litpic'] = getUploadFileUrl($row['litpic']);
$row['lit240'] = str_replace('litimg', 'lit240', $row['litpic']);
$row['lit160'] = str_replace('litimg', 'lit160', $row['litpic']);
$row['attrname'] = getTuanAttrname($row['attrid']);
$row['attrnamearr'] = getTuanAttrname($row['attrid'], true);
$row['destname'] = Helper_Archive::getBelongDestName($row['kindlist']);
//所属目的地
$row['destid'] = array_remove_value($row['kindlist']);
$row['discount'] = floor($row['price'] / $row['sellprice'] * 100) / 10;
//折扣
$row['booknum'] = Helper_Archive::getSellNum($row['id'], 13) + $row['virtualnum'];
$row['satisfyscore'] = Helper_Archive::getSatisfyScore($row['id'], 13);
//满意度
$row['price'] = $row['price'];
foreach ($ctp->CTags as $tagid => $ctag) {
if ($ctag->GetName() == 'array') {
$ctp->Assign($tagid, $row);
} else {
if (isset($row[$ctag->GetName()])) {
$ctp->Assign($tagid, $row[$ctag->GetName()]);
}
}
}
$revalue .= $ctp->GetResult();
}
return $revalue;
}
示例14: lib_gethotellist
/**
* 调用酒店数据标签
*
* @version $Id: gethotellist.lib.php netman
* @package Stourweb.Taglib
* @copyright Copyright (c) 2007 - 2011, Stourweb, Inc.
* @link http://www.stourweb.com
*/
function lib_gethotellist(&$ctag, &$refObj)
{
global $dsql;
$attlist = "row|8,flag|,type|top,sonid|,limit|0";
FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = trim($ctag->GetInnertext());
$revalue = '';
$basefield = 'a.id,a.sellpoint,a.aid,a.kindlist,a.title,a.address,a.litpic,a.ishidden,a.hotelrankid,a.webid,a.hotelrankid as hotelrankids,a.shownum,a.iconlist';
if ($type == 'top' && empty($flag)) {
return '';
}
//如果调用二级栏目则必须在显示类里指定sonid
$limit = !empty($limit) ? $limit : 0;
//加目的地页面显示条件
$destwhere = isset($refObj->Fields['kindid']) ? "and FIND_IN_SET({$refObj->Fields['kindid']},a.kindlist) " : '';
//用于聚合页面
if ($type == 'mdd') {
$sonid = $refObj->Fields['kindid'];
if ($GLOBALS['sys_child_webid'] != 0) {
$dest_id = $GLOBALS['sys_child_webid'];
//当前级目的地id.
}
$sonid = $sonid ? $sonid : $dest_id;
if (!isset($sonid)) {
return '';
}
if ($flag == 'hot') {
$orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc';
} else {
if ($flag == 'recommend') {
$orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc';
} else {
if ($flag == 'specical') {
$orderby = 'case when b.displayorder is null then 9999 end,b.displayorder asc';
} else {
$orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc';
}
}
}
$orderby .= ",a.modtime desc,a.addtime desc";
$where = "FIND_IN_SET({$sonid},a.kindlist)";
$sql = "select {$basefield},b.isding,b.isjian,b.istejia from #@__hotel a left join #@__kindorderlist as b on (a.id=b.aid and b.classid='{$sonid}' and b.typeid='2') where " . $where . " and (a.ishidden='0' or a.ishidden is null){$orderby} limit {$limit},{$row}";
} else {
if ($type == 'rank') {
if (isset($refObj->Fields['sonid'])) {
$sonid = $refObj->Fields['sonid'];
$sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on a.hotelrankid=b.aid where a.webid=0 and a.hotelrankid={$sonid} and a.ishidden='0' order by a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
return '';
}
} else {
if ($type == 'rankhot') {
$sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on a.hotelrankid=b.aid where a.ishidden='0' order by a.shownum desc limit {$limit},{$row}";
} else {
if ($type == 'theme') {
$themeid = $refObj->Fields['themeid'];
if (empty($themeid)) {
return '';
}
$sql = "select a.*,b.hotelrank,a.price as price from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid) where a.ishidden='0' and FIND_IN_SET({$themeid},a.themelist) order by a.modtime desc,a.addtime desc,a.shownum desc limit {$limit},{$row}";
} else {
if ($type == 'top') {
if ($flag == 'recommend') {
$sql = "select {$basefield},b.displayorder,b.isding,b.isjian,b.istejia,a.ishidden,a.price from #@__hotel a left join #@__allorderlist b on(a.id=b.aid and b.typeid=2) where a.ishidden='0' order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'special') {
$sql = "select {$basefield},b.displayorder,b.isding,b.isjian,b.istejia as istehui,a.ishidden from #@__hotel a left join #@__allorderlist b on(a.id=b.aid and b.typeid=2) order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'hot') {
$sql = "select a.*,b.hotelrank,a.price as price from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid) where a.ishidden='0' group by a.title order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}";
} else {
if ($flag == 'relative') {
$kindlist = $refObj->Fields['kindlist'];
$maxkindid = array_remove_value($kindlist);
//最后一级.
$maxkindid = empty($maxkindid) ? $GLOBALS['dest_id'] : $maxkindid;
$maxkindid = empty($maxkindid) ? 0 : $maxkindid;
$where = " FIND_IN_SET({$maxkindid},a.kindlist) ";
//排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联
$sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid) where a.ishidden='0' and {$where} order by a.modtime desc,a.addtime desc limit {$limit},{$row} ";
} else {
return '';
}
}
}
}
}
}
}
}
}
//.........这里部分代码省略.........
示例15: display_comments
/**
* list the child comments for one parent-comment
*
* @param mixed $parent ID of parent comment or "pro"/"contra"/"discussion"
* @param integer $level (optional) folding level, top level is 0
* @param boolean $full (optional) allow showing full text
*/
private function display_comments($parent, $level=0, $full=true) {
$sql = "SELECT comment.*, rating.score";
if (Login::$member) {
$sql .= ", seen.comment AS seen
FROM comment
LEFT JOIN rating ON rating.comment = comment.id AND rating.member = ".intval(Login::$member->id)."
LEFT JOIN seen ON seen.comment = comment.id AND seen.member = ".intval(Login::$member->id);
} else {
$sql .= "
FROM comment
LEFT JOIN rating ON rating.comment = comment.id AND rating.session = ".DB::esc(session_id());
}
// intval($parent) gives parent=0 for "pro"/"contra"/"discussion"
$sql .= "
WHERE proposal=".intval(self::$proposal->id)."
AND rubric=".DB::esc($this->rubric)."
AND parent=".intval($parent)."
ORDER BY removed, rating DESC, created";
$result = DB::query($sql);
$comments = array();
$open_ids = array();
while ( $comment = DB::fetch_object($result, "Comment") ) {
/** @var Comment $comment */
$comments[] = $comment;
if (in_array($comment->id, self::$open_ids)) $open_ids[] = $comment->id;
}
if (!$comments and self::$parent!=$parent) return;
?>
<ul>
<?
$position = 1;
$remaining = 0;
$new = 0;
$highlight_started = false;
$comments_head = self::comments_head($level);
$open = in_array($parent, self::$open);
foreach ( $comments as $comment ) {
$limit_reached = $position > $comments_head;
if (
$limit_reached and
!$open and
!$open_ids // display comments until all to be open have been displayed
) {
$remaining++;
if (Login::$member and !$comment->seen) $new++;
} else {
// highlight
if (
$limit_reached and
isset($_GET['openhl']) and $_GET['openhl']==$parent and
!$highlight_started
) {
?>
<div id="openhl">
<?
$highlight_started = true;
}
// display one comment and its children
$this->display_comment($comment, $position, $level, $full);
array_remove_value($open_ids, $comment->id);
}
$position++;
}
if ($highlight_started) {
?>
</div>
<?
}
// links to remaining comments only under fully shown comments
if ($remaining and $full) {
$open = self::$open;
$show = self::$show;
$open[] = $parent;
$open = array_unique($open);
?>
<li><a href="<?php
echo URI::append(['open' => $open, 'show' => $show, 'openhl' => $parent]);
?>
#openhl"><?
if (!intval($parent)) {
if ($this->rubric=="discussion") {
if ($new) printf(ngettext("show remaining 1 new comment", "show remaining %d comments, %d of them new", $remaining), $remaining, $new);
else printf(ngettext("show remaining 1 comment", "show remaining %d comments", $remaining), $remaining);
} else {
if ($new) printf(ngettext("show remaining 1 new argument", "show remaining %d arguments, %d of them new", $remaining), $remaining, $new);
else printf(ngettext("show remaining 1 argument", "show remaining %d arguments", $remaining), $remaining);
//.........这里部分代码省略.........