public function public_relationlist()
 {
     $show_header = '';
     $this->Model = F("Model");
     if (!isset($_GET['modelid'])) {
         $this->error("缺少参数!");
     } else {
         $modelid = intval($_GET['modelid']);
         $this->table_name = ucwords($this->Model[$modelid]['tablename']);
         $this->Content = M($this->table_name);
         $where = array();
         if ($_GET['catid']) {
             $catid = intval($_GET['catid']);
             $where['catid'] = array('eq', $catid);
         }
         $where['status'] = array('eq', 99);
         if (isset($_GET['keywords'])) {
             $keywords = trim($_GET['keywords']);
             $field = $_GET['field'];
             if (in_array($field, array('id', 'title', 'keywords', 'description'))) {
                 if ($field == 'id') {
                     $where['id'] = array('eq', $keywords);
                 } else {
                     $where[$field] = array('like', '%' . $keywords . '%');
                 }
             }
         }
         $count = $this->Content->where($where)->count();
         $page = $this->page($count, 12);
         $data = $this->Content->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
         foreach ($data as $k => $v) {
             $data[$k]['catid'] = $this->categorys[$data[$k]['catid']]['catname'];
             $data[$k]['inputtime'] = date('Y-m-d', $data[$k]['inputtime']);
         }
         $this->assign("Formcategory", Form::select_category($catid, 'name="catid"', "不限栏目", $modelid, 0, 1));
         $this->assign("data", $data);
         $this->assign("page", $page);
         $this->assign("modelid", $modelid);
         $this->display("relationlist");
     }
 }
 public function public_relationlist()
 {
     if (!isset($_GET['modelid'])) {
         $this->error("缺少参数!");
     } else {
         $modelid = I('get.modelid', 0, 'intval');
         $this->table_name = ucwords($this->model[$modelid]['tablename']);
         $this->Content = M($this->table_name);
         $where = array();
         $catid = $this->catid;
         if ($catid) {
             $where['catid'] = array('eq', $catid);
         }
         $where['status'] = array('eq', 99);
         if (isset($_GET['keywords'])) {
             $keywords = trim($_GET['keywords']);
             $field = $_GET['searchtype'];
             if (in_array($field, array('id', 'title', 'keywords', 'description'))) {
                 if ($field == 'id') {
                     $where['id'] = array('eq', $keywords);
                 } else {
                     $where[$field] = array('like', '%' . $keywords . '%');
                 }
             }
         }
         $count = $this->Content->where($where)->count();
         $page = $this->page($count, 12);
         $data = $this->Content->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
         $this->assign("Formcategory", Form::select_category($catid, 'name="catid"', "不限栏目", $modelid, 0, 1));
         $this->assign("data", $data);
         $this->assign("Page", $page->show('Admin'));
         $this->assign("modelid", $modelid);
         $this->display("relationlist");
     }
 }
Example #3
0
?>
<div class="pad-lr-10">
<form name="searchform" action="" method="get" >
<input type="hidden" value="digg" name="app">
<input type="hidden" value="range" name="controller">
<input type="hidden" value="init" name="action">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
		<div class="explain-col">
 		<?php 
echo L('category');
?>
:<?php 
echo Form::select_category('category_content', $catid, 'name="catid"', L('please_select'), '', 0, 1);
?>
 		<?php 
echo L('time');
?>
:<?php 
echo Form::select(array('1' => L('today'), '2' => L('yesterday'), '3' => L('this_week'), '4' => L('this_month'), '5' => L('all')), $datetype, 'name="datetype"');
?>
 		<?php 
echo L('sort');
?>
:<?php 
echo Form::select($order_list, $order, 'name="order"');
?>
				<input type="submit" name="search" class="btn btn-primary btn-sm"value="<?php 
echo L('view');
Example #4
0
 /**
  * 按照模型搜索
  */
 public function init()
 {
     $grouplist = S('member/grouplist');
     $_groupid = cookie('_groupid');
     if (empty($_groupid)) {
         $_groupid = 1;
     }
     if (!isset($grouplist[$_groupid]['allowsearch'])) {
         if ($_groupid == 1) {
             showmessage(L('guest_not_allowsearch'));
         } else {
             showmessage('');
         }
     }
     if (!isset($_GET['catid'])) {
         showmessage(L('missing_part_parameters'));
     }
     $catid = intval($_GET['catid']);
     $this->categorys = S('common/category_content');
     if (!isset($this->categorys[$catid])) {
         showmessage(L('missing_part_parameters'));
     }
     if (isset($_GET['info']['catid']) && $_GET['info']['catid']) {
         $catid = intval($_GET['info']['catid']);
     } else {
         $_GET['info']['catid'] = 0;
     }
     $modelid = $this->categorys[$catid]['modelid'];
     $modelid = intval($modelid);
     if (!$modelid) {
         showmessage(L('illegal_parameters'));
     }
     // 搜索间隔
     $minrefreshtime = S('common/common');
     $minrefreshtime = intval($minrefreshtime['minrefreshtime']);
     $minrefreshtime = $minrefreshtime ? $minrefreshtime : 5;
     if (cookie('search_cookie') && cookie('search_cookie') > TIME - 2) {
         showmessage(L('search_minrefreshtime', array('min' => $minrefreshtime)), 'index.php?app=content&controller=search&catid=' . $catid, $minrefreshtime * 1280);
     } else {
         cookie('search_cookie', TIME + 2);
     }
     // 搜索间隔
     $CATEGORYS = $this->categorys;
     // 产生表单
     $fields = S('model/model_field_' . $modelid);
     $forminfos = array();
     foreach ($fields as $field => $r) {
         if ($r['issearch']) {
             if ($r['formtype'] == 'catid') {
                 $r['form'] = Form::select_category('', $_GET['info']['catid'], 'name="info[catid]"', L('please_select_category'), $modelid, 0, 1);
             } elseif ($r['formtype'] == 'number') {
                 $r['form'] = "<input type='text' name='{$field}_start' id='{$field}_start' value='' size=5 class='input-text'/> - <input type='text' name='{$field}_end' id='{$field}_start' value='' size=5 class='input-text'/>";
             } elseif ($r['formtype'] == 'datetime') {
                 $r['form'] = Form::date("info[{$field}]");
             } elseif ($r['formtype'] == 'box') {
                 $options = explode("\n", $r['options']);
                 foreach ($options as $_k) {
                     $v = explode("|", $_k);
                     $option[$v[1]] = $v[0];
                 }
                 switch ($r['boxtype']) {
                     case 'radio':
                         $string = Form::radio($option, $value, "name='info[{$field}]' id='{$field}'");
                         break;
                     case 'checkbox':
                         $string = Form::radio($option, $value, "name='info[{$field}]' id='{$field}'");
                         break;
                     case 'select':
                         $string = Form::select($option, $value, "name='info[{$field}]' id='{$field}'");
                         break;
                     case 'multiple':
                         $string = Form::select($option, $value, "name='info[{$field}]' id='{$field}'");
                         break;
                 }
                 $r['form'] = $string;
             } elseif ($r['formtype'] == 'typeid') {
                 $types = S('common/type_content');
                 $types_array = array(L('no_limit'));
                 foreach ($types as $_k => $_v) {
                     if ($modelid == $_v['modelid']) {
                         $types_array[$_k] = $_v['name'];
                     }
                 }
                 $r['form'] = Form::select($types_array, 0, "name='info[{$field}]' id='{$field}'");
             } elseif ($r['formtype'] == 'linkage') {
                 $setting = string2array($r['setting']);
                 $value = $_GET['info'][$field];
                 $r['form'] = menu_linkage($setting['linkageid'], $field, $value);
             } elseif (in_array($r['formtype'], array('text', 'keyword', 'textarea', 'editor', 'title', 'author', 'omnipotent'))) {
                 $value = safe_replace($_GET['info'][$field]);
                 $r['form'] = "<input type='text' name='info[{$field}]' id='{$field}' value='" . $value . "' class='input-text search-text'/>";
             } else {
                 continue;
             }
             $forminfos[$field] = $r;
         }
     }
     // -----------
     if (isset($_GET['dosubmit'])) {
         $this->db->set_model($modelid);
         $tablename = $this->db->table_name;
         $page = max(intval($_GET['page']), 1);
         $sql = "SELECT * FROM `{$tablename}` a,`{$tablename}_data` b WHERE a.id=b.id AND a.status=99";
         $sql_count = "SELECT COUNT(*) AS num FROM `{$tablename}` a,`{$tablename}_data` b WHERE a.id=b.id AND a.status=99";
         // 构造搜索SQL
         $where = '';
         foreach ($fields as $field => $r) {
             if ($r['issearch']) {
                 $table_nickname = $r['issystem'] ? 'a' : 'b';
                 if ($r['formtype'] == 'catid') {
                     if ($_GET['info']['catid']) {
                         $where .= " AND {$table_nickname}.catid='{$catid}'";
                     }
                 } elseif ($r['formtype'] == 'number') {
                     $start = "{$field}_start";
                     $end = "{$field}_end";
                     if ($_GET[$start]) {
                         $start = intval($_GET[$start]);
                         $where .= " AND {$table_nickname}.{$field}>'{$start}'";
                     }
                     if ($_GET[$end]) {
                         $end = intval($_GET[$end]);
                         $where .= " AND {$table_nickname}.{$field}<'{$end}'";
                     }
                 } elseif ($r['formtype'] == 'datetime') {
                     if ($_GET['info'][$field]) {
                         $start = strtotime($_GET['info'][$field]);
                         if ($start) {
                             $where .= " AND {$table_nickname}.{$field}>'{$start}'";
                         }
                     }
                 } elseif ($r['formtype'] == 'box') {
                     if ($_GET['info'][$field]) {
                         $field_value = safe_replace($_GET['info'][$field]);
                         switch ($r['boxtype']) {
                             case 'radio':
                                 $where .= " AND {$table_nickname}.`{$field}`='{$field_value}'";
                                 break;
                             case 'checkbox':
                                 $where .= " AND {$table_nickname}.`{$field}` LIKE '%,{$field_value},%'";
                                 break;
                             case 'select':
                                 $where .= " AND {$table_nickname}.`{$field}`='{$field_value}'";
                                 break;
                             case 'multiple':
                                 $where .= " AND {$table_nickname}.`{$field}` LIKE '%,{$field_value},%'";
                                 break;
                         }
                     }
                 } elseif ($r['formtype'] == 'typeid') {
                     if ($_GET['info'][$field]) {
                         $typeid = intval($_GET['info'][$field]);
                         $where .= " AND {$table_nickname}.`{$field}`='{$typeid}'";
                     }
                 } elseif ($r['formtype'] == 'linkage') {
                     if ($_GET['info'][$field]) {
                         $linkage = intval($_GET['info'][$field]);
                         $where .= " AND {$table_nickname}.`{$field}`='{$linkage}'";
                     }
                 } elseif (in_array($r['formtype'], array('text', 'keyword', 'textarea', 'editor', 'title', 'author', 'omnipotent'))) {
                     if ($_GET['info'][$field]) {
                         $keywords = safe_replace($_GET['info'][$field]);
                         $where .= " AND {$table_nickname}.`{$field}` LIKE '%{$keywords}%'";
                     }
                 } else {
                     continue;
                 }
             }
         }
         // -----------
         if ($where == '') {
             showmessage(L('please_enter_content_to_search'));
         }
         $pagesize = 20;
         $offset = intval($pagesize * ($page - 1));
         $sql_count .= $where;
         $this->db->query($sql_count);
         $total = $this->db->fetch_array();
         $total = $total[0]['num'];
         if ($total != 0) {
             $sql .= $where;
             $order = '';
             $order = $_GET['orderby'] == 'a.id DESC' ? 'a.id DESC' : 'a.id ASC';
             $sql .= ' ORDER BY ' . $order;
             $sql .= " LIMIT {$offset},{$pagesize}";
             $this->db->query($sql);
             $datas = $this->db->fetch_array();
             $pages = Page::pages($total, $page, $pagesize);
         } else {
             $datas = array();
             $pages = '';
         }
     }
     $SEO = seo($catid, $keywords);
     include template('content', 'search');
 }
 /**
  * 推荐位添加栏目加载
  */
 public function public_category_load()
 {
     $modelid = intval($_GET['modelid']);
     import('Form');
     $category = Form::select_category('', 'name="info[catid]"', "=不限栏目=", $modelid, 0, 1);
     echo $category;
 }
Example #6
0
					onclick="SwapTab('setting','on','',1,1);"><?php 
echo L('catgory_basic');
?>
</li>
			</ul>
			<div id="div_setting_1" class="contentList pad-10">

				<table width="100%" class="table_form ">
					<tr>
						<th width="200"><?php 
echo L('parent_category');
?>
:</th>
						<td>
		<?php 
echo Form::select_category('category_content', $parentid, 'name="info[parentid]"', L('please_select_parent_category'), 0, -1);
?>
		</td>
					</tr>
					<tr>
						<th><?php 
echo L('catname');
?>
:</th>
						<td><input type="text" name="info[catname]" id="catname"
							class="input-text" value="<?php 
echo $catname;
?>
"></td>
					</tr>
Example #7
0
/**
 * 生成标签选项
 *
 * @param $id HTML
 *        	ID号
 * @param $data 生成条件
 * @param $value 当前值
 * @param $op 操作名
 * @return html 返回HTML代码
 */
function creat_form($id, $data, $value = '', $op = '')
{
    if (empty($value)) {
        $value = $data['defaultvalue'];
    }
    $str = $ajax = '';
    if ($data['ajax']['name']) {
        if ($data['ajax']['m']) {
            $url = '$.get(\'?app=content&controller=push&action=public_ajax_get\', {html: this.value, id:\'' . $data['ajax']['id'] . '\', do: \'' . $data['ajax']['do'] . '\', application: \'' . $data['ajax']['m'] . '\'}, function(data) {$(\'#' . $id . '_td\').html(data)});';
        } else {
            $url = '$.get(\'?app=template&controller=file&action=public_ajax_get\', { html: this.value, id:\'' . $data['ajax']['id'] . '\', do: \'' . $data['ajax']['do'] . '\', op: \'' . $op . '\', style: \'default\'}, function(data) {$(\'#' . $id . '_td\').html(data)});';
        }
    }
    switch ($data['htmltype']) {
        case 'input':
            if ($data['ajax']['name']) {
                $ajax = 'onblur="' . $url . '"';
            }
            $str .= '<input type="text" name="' . $id . '" id="' . $id . '" value="' . $value . '" size="30" />';
            break;
        case 'select':
            if ($data['ajax']['name']) {
                $ajax = 'onchange="' . $url . '"';
            }
            $str .= Form::select($data['data'], $value, "name='{$id}' id='{$id}' {$ajax}");
            break;
        case 'checkbox':
            if ($data['ajax']['name']) {
                $ajax = ' onclick="' . $url . '"';
            }
            if (is_array($value)) {
                implode(',', $value);
            }
            $str .= Form::checkbox($data['data'], $value, "name='" . $id . "[]'" . $ajax, '', '120');
            break;
        case 'radio':
            if ($data['ajax']['name']) {
                $ajax = ' onclick="' . $url . '"';
            }
            $str .= Form::radio($data['data'], $value, "name='{$id}'{$ajax}", '', '120');
            break;
        case 'input_select':
            if ($data['ajax']['name']) {
                $ajax = ';' . $url;
            }
            $str .= '<input type="text" name="' . $id . '" id="' . $id . '" value="' . $value . '" size="30" />' . Form::select($data['data'], $value, "name='select_{$id}' id='select_{$id}' onchange=\"\$('#{$id}').val(this.value);{$ajax}\"");
            break;
        case 'input_select_category':
            if ($data['ajax']['name']) {
                $ajax = ';' . $url;
            }
            $str .= '<input type="text" name="' . $id . '" id="' . $id . '" value="' . $value . '" size="30" />' . Form::select_category('', $value, "name='select_{$id}' id='select_{$id}' onchange=\"\$('#{$id}').val(this.value);{$ajax}\"", '', isset($data['data']['modelid']) ? $data['data']['modelid'] : 0, isset($data['data']['type']) ? $data['data']['type'] : -1, isset($data['data']['onlysub']) ? $data['data']['onlysub'] : 0);
            break;
    }
    if (!empty($data['validator'])) {
        $str .= '<script type="text/javascript">
        $(function(){$("#' . $id . '").formValidator({onshow:"' . L('input') . $data['name'] . '。",onfocus:"' . L('input') . $data['name'] . '。"' . ($data['empty'] ? ',empty:true' : '') . '})';
        if ($data['htmltype'] != 'select' && (isset($data['validator']['min']) || isset($data['validator']['max']))) {
            $str .= ".inputValidator({" . (isset($data['validator']['min']) ? 'min:' . $data['validator']['min'] . ',' : '') . (isset($data['validator']['max']) ? 'max:' . $data['validator']['max'] . ',' : '') . " onerror:'" . $data['name'] . L('should', '', 'template') . (isset($data['validator']['min']) ? ' ' . L('is_greater_than', '', 'template') . $data['validator']['min'] . L('lambda', '', 'template') : '') . (isset($data['validator']['max']) ? ' ' . L('less_than', '', 'template') . $data['validator']['max'] . L('lambda', '', 'template') : '') . "。'})";
        }
        if ($data['htmltype'] != 'checkbox' && $data['htmltype'] != 'radio' && isset($data['validator']['reg'])) {
            $str .= '.regexValidator({regexp:"' . $data['validator']['reg'] . '"' . (isset($data['validator']['reg_param']) ? ",param:'" . $data['validator']['reg_param'] . "'" : '') . (isset($data['validator']['reg_msg']) ? ',onerror:"' . $data['validator']['reg_msg'] . '"' : '') . '})';
        }
        $str .= ";});</script>";
    }
    return $str;
}
Example #8
0
  <div class="table_full"> 
  <table width="100%" class="table_form contentWrap">
        <tr>
          <th  width="80">推荐位名称</th>
          <td><input type="text" name="info[name]" value="" class="input" id="name"/></td>
        </tr>
        <tr>
          <th>所属模型</th>
          <td><?php 
echo Form::select($modelinfo, $modelid, 'name="info[modelid]" onchange="category_load(this);"', '请选择模型');
?>
</tr>
        <tr>
          <th>所属栏目</th>
          <td id="load_catid"><?php 
echo Form::select_category($catid, 'name="info[catid]"', "=不限栏目=", $modelid, 0, 1);
?>
</td>
        </tr>
        <tr>
          <th>排序</th>
          <td><input type="text" name="info[listorder]" id="listorder" class="input" size="5" value=""/></td>
        </tr>
        <tr>
          <th>最大保存条数</th>
          <td><input type="text" name="info[maxnum]" id="maxnum" class="input" size="5" value="10"/>
            条</td>
        </tr>
      </table>
  </div>
  <div class="">
Example #9
0
<fieldset>
	<legend><?php 
echo L('the_new_publication_solutions');
?>
</legend>
	<form name="myform" action="?" method="get" id="myform">

		<table width="100%" class="table_form">
			<tr>
			<td width="120"><?php 
echo L('category');
?>
:</td>
			<td>
			<?php 
echo Form::select_category('', '', 'name="catid"', L('please_choose'), 0, 0, 1);
?>
			</td>
		</tr>
	</table>
	<input type="hidden" name="app" value="collection">
	<input type="hidden" name="controller" value="node">
	<input type="hidden" name="action" value="import_program_add">
	<input type="hidden" name="nodeid" value="<?php 
if (isset($nodeid)) {
    echo $nodeid;
}
?>
">
	<input type="hidden" name="type" value="<?php 
echo $type;
Example #10
0
 /**
  * 按模型ID列出模型下的栏目
  */
 public function public_categorys_list()
 {
     if (!isset($_GET['modelid']) || empty($_GET['modelid'])) {
         exit('');
     }
     $modelid = intval($_GET['modelid']);
     exit(Form::select_category('', $_GET['catid'], 'name="catid" id="catid"', L('please_select'), $modelid, 0, 1));
 }
 public function public_relationlist()
 {
     if (IS_POST) {
         $modelid = getCategory($this->catid, 'modelid');
         $_POST['modelid'] = $modelid;
         $this->redirect('public_relationlist', $_POST);
     }
     $modelid = I('get.modelid', 0, 'intval');
     if (empty($modelid)) {
         $this->error('缺少参数!');
     } else {
         $modelid = I('get.modelid', 0, 'intval');
         $model = ContentModel::getInstance($modelid);
         $where = array();
         $catid = $this->catid;
         if ($catid) {
             $where['catid'] = $catid;
         }
         $where['status'] = 99;
         if (isset($_GET['keywords'])) {
             $keywords = trim($_GET['keywords']);
             $field = $_GET['searchtype'];
             if (in_array($field, array('id', 'title', 'keywords', 'description'))) {
                 if ($field == 'id') {
                     $where['id'] = array('eq', $keywords);
                 } else {
                     $where[$field] = array('like', '%' . $keywords . '%');
                 }
             }
         }
         $count = $model->where($where)->count();
         $page = $this->page($count, 12);
         $data = $model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array('id' => "DESC"))->select();
         $this->assign('Formcategory', \Form::select_category($catid, 'name="catid"', "不限栏目", 0, 0, 1));
         $this->assign('data', $data);
         $this->assign('Page', $page->show());
         $this->assign('modelid', $modelid);
         $this->display('relationlist');
     }
 }
Example #12
0
			<tr>
				<td width="80"><?php 
echo L('category');
?>
:</td>
				<td><?php 
if (isset($_GET['dosubmit'])) {
    ?>
<div class="rt">
						<a href="javascript:void(0)" onclick="$('#search').toggle()"><?php 
    echo L('folded_up_in_search_of');
    ?>
</a>
					</div><?php 
}
echo Form::select_category('category_content', $catid, 'name="catid" id="catid"', '', '', '0', 1);
?>
 </td>
			</tr>
			<tbody id="search"
				<?php 
if (isset($_GET['dosubmit'])) {
    echo 'style="display:none"';
}
?>
>
				<tr>
					<td><?php 
echo L('posterize_time');
?>
:</td>
Example #13
0
 /**
  * 推荐位添加栏目加载
  */
 public function public_category_load()
 {
     $modelid = intval($_GET['modelid']);
     $category = Form::select_category('category_content', '', 'name="info[catid]"', L('please_select_parent_category'), $modelid);
     echo $category;
 }