Example #1
0
/**
 * 关键字字段类型数据获取
 * @param type $field 字段名
 * @param type $value 字段内容
 * @return int
 */
function keyword($field, $value)
{
    if ($value == '') {
        return $value;
    }
    return \Input::forTag($value);
}
Example #2
0
/**
 * 标题字段,表单组合处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @param type $fieldinfo 字段配置
 * @return string
 */
function title($field, $value, $fieldinfo)
{
    //取得标题样式
    $style_arr = explode(';', $this->data['style']);
    //取得标题颜色
    $style_color = $style_arr[0];
    //是否粗体
    $style_font_weight = $style_arr[1] ? $style_arr[1] : '';
    //组合成CSS样式
    $style = 'color:' . $this->data['style'];
    //错误提示
    $errortips = $fieldinfo['errortips'];
    //是否进行最小长度验证
    if ($fieldinfo['minlength']) {
        //验证规则
        $this->formValidateRules['info[' . $field . ']'] = array("required" => true);
        //验证不通过提示
        $this->formValidateMessages['info[' . $field . ']'] = array("required" => $errortips ? $errortips : "标题不能为空!");
    }
    $str = '<input type="text" style="width:400px;' . ($style_color ? 'color:' . $style_color . ';' : '') . ($style_font_weight ? 'font-weight:' . $style_font_weight . ';' : '') . '" name="info[' . $field . ']" id="' . $field . '" value="' . \Input::forTag($value) . '" style="' . $style . '" class="input input_hd J_title_color" placeholder="请输入标题" onkeyup="strlen_verify(this, \'' . $field . '_len\', ' . $fieldinfo['maxlength'] . ')" />
                <input type="hidden" name="style_font_weight" id="style_font_weight" value="' . $style_font_weight . '">';
    //后台的情况下
    if (defined('IN_ADMIN') && IN_ADMIN) {
        $str .= '<input type="button" class="btn" id="check_title_alt" value="标题检测" onclick="$.get(\'' . U('Content/Content/public_check_title', array('catid' => $this->catid)) . '\', {data:$(\'#title\').val()}, function(data){if(data.status==false) {$(\'#check_title_alt\').val(\'标题重复\');$(\'#check_title_alt\').css(\'background-color\',\'#FFCC66\');} else if(data.status==true) {$(\'#check_title_alt\').val(\'标题不重复\');$(\'#check_title_alt\').css(\'background-color\',\'#F8FFE1\')}},\'json\')" style="width:73px;"/>
                    <span class="color_pick J_color_pick"><em style="background:' . $style_color . ';" class="J_bg"></em></span><input type="hidden" name="style_color" id="style_color" class="J_hidden_color" value="' . $style_color . '">
                    <img src="' . CONFIG_SITEURL_MODEL . 'statics/images/icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand"/>';
    }
    $str .= ' <span>还可输入<B><span id="title_len">' . $fieldinfo['maxlength'] . '</span></B> 个字符</span>';
    return $str;
}
Example #3
0
/**
 * 关键字类型字段,表单组合处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @param type $fieldinfo 字段配置
 * @return type 
 */
function keyword($field, $value, $fieldinfo)
{
    //错误提示
    $errortips = $fieldinfo['errortips'];
    //字段最小长度检测
    if ($fieldinfo['minlength']) {
        //验证规则
        $this->formValidateRules['info[' . $field . ']'] = array("required" => true);
        //验证不通过提示
        $this->formValidateMessages['info[' . $field . ']'] = array("required" => $errortips ? $errortips : "请输入关键字!");
    }
    return "<input type='text' name='info[{$field}]' id='{$field}' value='" . \Input::forTag($value) . "' style='width:280px' {$fieldinfo['formattribute']} {$fieldinfo['css']} class='input' placeholder='请输入关键字'>";
}
Example #4
0
/**
 * 来源字段 表单组合处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @param type $fieldinfo 字段配置
 * @return type
 */
function copyfrom($field, $value, $fieldinfo)
{
    //扩展配置
    $setting = unserialize($fieldinfo['setting']);
    if (empty($value)) {
        $value = $setting['defaultvalue'];
    }
    //错误提示
    $errortips = $fieldinfo['errortips'];
    //字段最小值判断
    if ($fieldinfo['minlength']) {
        //验证规则
        $this->formValidateRules['info[' . $field . ']'] = array("required" => true);
        //验证不通过提示
        $this->formValidateMessages['info[' . $field . ']'] = array("required" => $errortips ? $errortips : $fieldinfo['name'] . "不能为空!");
    }
    $width = $setting['width'] ? $setting['width'] : 180;
    return "<input type='text' name='info[{$field}]' value='" . \Input::forTag($value) . "' style='width:{$width}px;' class='input' placeholder='信息来源'/>";
}
Example #5
0
/**
 * 作者字段类型表单组合处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @param type $fieldinfo 字段配置
 * @return type
 */
function author($field, $value, $fieldinfo)
{
    //扩展配置
    $setting = unserialize($fieldinfo['setting']);
    //默认显示
    if ($value == '') {
        $value = $setting['defaultvalue'];
    }
    //错误提示
    $errortips = $fieldinfo['errortips'];
    if ($fieldinfo['minlength']) {
        //验证规则
        $this->formValidateRules['info[' . $field . ']'] = array("required" => true);
        //验证不通过提示
        $this->formValidateMessages['info[' . $field . ']'] = array("required" => $errortips ? $errortips : $fieldinfo['name'] . "不能为空!");
    }
    //宽度
    $width = $setting['width'] ? 'width:' . $setting['width'] . 'px' : 'width:180px';
    return '<input type="text" class="input" name="info[' . $field . ']" value="' . \Input::forTag($value) . '" style="' . $width . '" placeholder="请输入' . $fieldinfo['name'] . '信息">';
}
Example #6
0
/**
 * 作者字段类型表单获取数据处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @return string 字段内容
 */
function author($field, $value)
{
    return \Input::forTag($value);
}
Example #7
0
/**
 * 标题字段类型数据获取
 * @param type $field 字段名
 * @param type $value 字段内容
 * @return int
 */
function title($field, $value)
{
    return \Input::forTag($value);
}
Example #8
0
/**
 * 获取字段来源处理
 * @param type $field
 * @param string $value
 * @return string
 */
function copyfrom($field, $value)
{
    return \Input::forTag($value);
}
 /**
  * 编辑字段 
  */
 public function edit()
 {
     if (IS_POST) {
         $db = D("CommentsField");
         $fid = (int) $this->_post("fid");
         $r = $db->where(array("fid" => $fid))->find();
         $data = $db->create();
         if ($data) {
             unset($data['issystem']);
             $field = $db->ReturnPlFtype($data);
             $data['regular'] = Input::forTag($_POST['regular']);
             if ($db->save($data) === false) {
                 $this->error("更新失败!");
             }
             if ($data['f'] != $r['f']) {
                 if (!$this->checkfield($this->_post("f"))) {
                     $this->error("该字段已经存在!");
                 }
             }
             $stbsum = $this->CommentsSetting;
             if ($r['ftype'] != $data['ftype']) {
                 $Model = new Model();
                 if ($r['issystem'] == 1) {
                     $Model->query("alter table " . C("DB_PREFIX") . "comments change `" . $r['f'] . "` " . $field);
                 } else {
                     for ($i = 1; $i <= $stbsum['stbsum']; $i++) {
                         $Model->query("alter table " . C("DB_PREFIX") . "comments_data_" . $i . " change `" . $r['f'] . "` " . $field);
                     }
                 }
             }
             $this->success("更新成功!", U("Comments/Field/index"));
         } else {
             $this->error($db->getError());
         }
     } else {
         $fid = (int) $this->_get("fid");
         $data = M("CommentsField")->where(array("fid" => $fid))->find();
         if (!$data) {
             $this->error("该自定义字段不存在!");
         }
         $data['regular'] = Input::forTag($data['regular']);
         $this->assign("data", $data);
         $this->display();
     }
 }
Example #10
0
        <td><input type="radio" name="setting[mbtoolbar]" value="basic" <?php 
if ($setting['mbtoolbar'] == 'basic') {
    echo 'checked';
}
?>
> 简洁型 <input type="radio" name="setting[mbtoolbar]" value="full" <?php 
if ($setting['mbtoolbar'] == 'full') {
    echo 'checked';
}
?>
> 标准型 </td>
    </tr>
    <tr> 
        <td>默认值:</td>
        <td><textarea name="setting[defaultvalue]" rows="2" cols="20" id="defaultvalue" style="height:100px;width:99%;"><?php 
echo \Input::forTag($setting['defaultvalue']);
?>
</textarea></td>
    </tr>
    <tr> 
        <td>是否保存远程图片:</td>
        <td><input type="radio" name="setting[enablesaveimage]" value="1" <?php 
if ($setting['enablesaveimage'] == 1) {
    echo 'checked';
}
?>
> 是 <input type="radio" name="setting[enablesaveimage]" value="0"  <?php 
if ($setting['enablesaveimage'] == 0) {
    echo 'checked';
}
?>
 public function public_getsite_categorys()
 {
     $catid = $this->catid;
     $tree = new \Tree();
     $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $categorys = array();
     if (User::getInstance()->isAdministrator() !== true) {
         $this->priv_db = M('CategoryPriv');
         $priv_result = $this->priv_db->where(array('action' => 'add', 'roleid' => User::getInstance()->role_id, 'is_admin' => 1))->select();
         $priv_catids = array();
         foreach ($priv_result as $_v) {
             $priv_catids[] = $_v['catid'];
         }
         if (empty($priv_catids)) {
             return '';
         }
     }
     $categorysList = cache('Category');
     foreach ($categorysList as $r) {
         $r = getCategory($r['catid']);
         if ($r['type'] != 0) {
             continue;
         }
         if (User::getInstance()->role_id != 1 && !in_array($r['catid'], $priv_catids)) {
             $arrchildid = explode(',', $r['arrchildid']);
             $array_intersect = array_intersect($priv_catids, $arrchildid);
             if (empty($array_intersect)) {
                 continue;
             }
         }
         $r['modelname'] = $this->model[$r['modelid']]['name'];
         $r['style'] = $r['child'] ? 'color:#8A8A8A;' : '';
         $r['click'] = $r['child'] ? '' : " id=\"cv" . $r['catid'] . "\" onclick=\"select_list(this,'" . \Input::forTag($r['catname']) . "'," . $r['catid'] . ")\" class='cu' title='" . \Input::forTag($r['catname']) . "'";
         $categorys[$r['catid']] = $r;
     }
     $str = "<tr \$click >\n\t\t\t\t\t<td align='center'>\$id</td>\n\t\t\t\t\t<td style='\$style'>\$spacer\$catname</td>\n\t\t\t\t\t<td align='center'>\$modelname</td>\n\t\t\t\t</tr>";
     $tree->init($categorys);
     $categorys = $tree->get_tree(0, $str);
     exit($categorys);
 }