/**
 * 用于视频播放器字段输出
 *
 * @param	string	$name		字段名称
 * @param	array	$value		字段值
 * @param	intval	$width		宽度
 * @param	intval	$height		高度
 * @param	string	$next_url	下一集url
 * @param	string	$title		视频分享标题
 * @param	string	$url		视频分享url
 * @param	string	$desc		视频分享描述
 * @param	string	$thumb		视频分享图片
 * @return	array
 */
function dr_player($name, $value, $width, $height, $next_url = '', $title = '', $url = '', $desc = '', $thumb = '')
{
    $file = dr_get_file($value['file']);
    $str = '
	<div id="video" style="position:relative;z-index: 51;width:' . $width . 'px;height:' . $height . 'px;"><div id="a1"></div></div>
	<script type="text/javascript" src="' . SITE_URL . 'player/offlights.js"></script>
	<script type="text/javascript" src="' . SITE_URL . 'player/ckplayer.js" charset="utf-8"></script>
	<script type="text/javascript">
		var flashvars={
			s:2,
			f:\'' . SITE_URL . 'player/video.php?url=[$pat]\',
			a:\'' . $file . '\',
			c:0,
			b:1,
			h:4,
			p:1,' . PHP_EOL;
    // 定时点处理
    if ($value['point']) {
        $k = $n = '';
        foreach ($value['point'] as $time => $note) {
            $k .= $time . '|';
            $n .= $note . '|';
        }
        $str .= '			k:\'' . trim($k, '|') . '\',' . PHP_EOL;
        $str .= '			n:\'' . trim($n, '|') . '\',' . PHP_EOL;
    }
    // 广告处理
    $mod = get_module(APP_DIR, SITE_ID);
    $option = '';
    if ($mod['field'][$name]) {
        $option = $mod['field'][$name]['setting']['option'];
    } elseif ($mod['extend'][$name]) {
        $option = $mod['extend'][$name]['setting']['option'];
    }
    if ($option && $option['table']) {
        $ci =& get_instance();
        if ($option['time'][$ci->markrule]) {
            $time = $option['time'][$ci->markrule];
            // 查询该表的数据
            $form = $ci->get_cache('form-' . SITE_ID, $option['table']);
            if ($form) {
                $data = $ci->site[SITE_ID]->order_by('id', 'RANDOM')->limit(1)->get(SITE_ID . '_form_' . $form['table'])->row_array();
                if ($data) {
                    $str .= '			l:\'' . dr_thumb($data['thumb']) . '\',' . PHP_EOL;
                    $str .= '			r:\'' . $data['link'] . '\',' . PHP_EOL;
                    $str .= '			t:\'' . $time . '\',' . PHP_EOL;
                    $str .= '			d:\'' . dr_thumb($data['thumb']) . '\',' . PHP_EOL;
                    $str .= '			u:\'' . $data['link'] . '\',' . PHP_EOL;
                    $member = '<style>.dr_adv td, .dr_adv th { border-bottom: 1px solid #EEEEEE;height: 22px;line-height: 22px;padding-bottom: 3px;padding-top: 3px;}.dr_adv td{ text-align:right;}</style><table class="dr_adv">';
                    $MEMBER = $ci->get_cache('member');
                    $member .= '<tr>';
                    $member .= '	<th align="left" width="200">' . lang('m-347') . '</th>';
                    $member .= '	<td align="left">';
                    $member .= ' ' . (int) $option['time'][0] . lang('m-330');
                    $member .= ' </td>';
                    $member .= '</tr>';
                    foreach ($MEMBER['group'] as $group) {
                        if ($group['id'] > 2) {
                            $member .= '<tr>';
                            $member .= '	<th align="left">' . $group['name'] . '</th>';
                            $member .= '	<td align="left"></td>';
                            $member .= '</tr>';
                            foreach ($group['level'] as $level) {
                                $id = $group['id'] . '_' . $level['id'];
                                $member .= '<tr>';
                                $member .= '<th align="left" style="padding-left:40px">' . $level['name'] . '&nbsp;&nbsp;' . dr_show_stars($level['stars']) . '</th>';
                                $member .= '<td align="left">';
                                $member .= '' . (int) $option['time'][$id] . lang('m-330');
                                $member .= '</td>';
                                $member .= '</tr>';
                            }
                        } else {
                            $member .= '<tr>';
                            $member .= '	<th align="left">' . $group['name'] . '</th>';
                            $member .= '	<td align="left">';
                            $member .= ' ' . (int) $option['time'][$group['id']] . lang('m-330');
                            $member .= ' </td>';
                            $member .= '</tr>';
                        }
                    }
                    $member .= '<tr>';
                    $member .= '	<td style="border:none;text-align:center;"><a href="' . MEMBER_URL . 'index.php?c=account&m=upgrade" target="_blank" style="color:red;">' . lang('m-348') . '</a></td>';
                    $member .= '</tr>';
                    $member .= '</table>';
                }
            }
        }
    }
    if ($next_url) {
        $str .= '			e:0,' . PHP_EOL;
    } else {
        $str .= '			e:2,' . PHP_EOL;
    }
    $str .= '			my_title:\'' . $title . '\',
			my_url:\'' . $url . '\',
			my_summary:\'' . str_replace(array('\'', '"'), '', dr_clearhtml(dr_strcut($desc, 200))) . '\',
			my_pic:\'' . dr_get_file($thumb) . '\'
		};
		var params={
			bgcolor:\'#FFF\',
			allowFullScreen:true,
			allowScriptAccess:\'always\'
		};
		CKobject.embedSWF(\'' . SITE_URL . 'player/ckplayer.swf\',\'a1\',\'ckplayer_a1\',\'' . $width . '\',\'' . $height . '\',flashvars,params);
    ';
    if ($next_url) {
        $str .= 'function playerstop(){
			location.href="' . $next_url . '";
		}';
    }
    $str .= '
		function ckadjump(){
			var throughBox = art.dialog.through;
			throughBox({
				content: \'' . $member . '\',
				lock: true,
				opacity: 0.1
			});
		}
		var box = new LightBox();
		function closelights(){
			box.Show();
			CKobject._K_(\'video\').style.width=\'' . $width . 'px\';
			CKobject._K_(\'video\').style.height=\'' . $height . 'px\';
			swfobject.getObjectById(\'ckplayer_a1\').width=' . $width . ';
			swfobject.getObjectById(\'ckplayer_a1\').height=' . $height . ';
		}
		function openlights(){
			box.Close();
			CKobject._K_(\'video\').style.width=\'' . $width . 'px\';
			CKobject._K_(\'video\').style.height=\'' . $height . 'px\';
			swfobject.getObjectById(\'ckplayer_a1\').width=' . $width . ';
			swfobject.getObjectById(\'ckplayer_a1\').height=' . $height . ';
		}
	</script>
	';
    return $str;
}
示例#2
0
    /**
     * 字段相关属性参数
     *
     * @param	array	$value	值
     * @return  string
     */
    public function option($option)
    {
        $option['width'] = isset($option['width']) ? $option['width'] : '80%';
        $option['uploadpath'] = isset($option['uploadpath']) ? $option['uploadpath'] : '';
        $member = '<table>';
        $MEMBER = $this->ci->get_cache('member');
        $member .= '<tr>';
        $member .= '	<td align="left" width="210">' . lang('guest') . '</td>';
        $member .= '	<td align="left">';
        $member .= ' <input type="text" class="input-text" size="5" name="data[setting][option][time][0]" value="' . $option['time'][0] . '" />' . lang('311');
        $member .= ' </td>';
        $member .= '</tr>';
        foreach ($MEMBER['group'] as $group) {
            if ($group['id'] > 2) {
                $member .= '<tr>';
                $member .= '	<td align="left" width="210">' . $group['name'] . '</td>';
                $member .= '	<td align="left"></td>';
                $member .= '</tr>';
                foreach ($group['level'] as $level) {
                    $id = $group['id'] . '_' . $level['id'];
                    $member .= '<tr>';
                    $member .= '<td align="left" width="210" style="padding-left:40px">' . $level['name'] . '&nbsp;&nbsp;' . dr_show_stars($level['stars']) . '</td>';
                    $member .= '<td align="left">';
                    $member .= '<input type="text" class="input-text" size="5" name="data[setting][option][time][' . $id . ']" value="' . $option['time'][$id] . '" />' . lang('311');
                    $member .= '</td>';
                    $member .= '</tr>';
                }
            } else {
                $member .= '<tr>';
                $member .= '	<td align="left" width="210">' . $group['name'] . '</td>';
                $member .= '	<td align="left">';
                $member .= ' <input type="text" class="input-text" size="5" name="data[setting][option][time][' . $group['id'] . ']" value="' . $option['time'][$group['id']] . '" />' . lang('311');
                $member .= ' </td>';
                $member .= '</tr>';
            }
        }
        $member .= '<tr>';
        $member .= '	<td align="left" style="border:none">' . lang('html-598') . '</td>';
        $member .= '</tr>';
        $member .= '</table>';
        $form = $this->ci->get_cache('form-' . SITE_ID);
        $adsense = '<select name="data[setting][option][table]">';
        if ($form) {
            foreach ($form as $t) {
                $adsense .= '<option value="' . $t['id'] . '" ' . ($option['table'] == $t['id'] ? 'selected' : '') . '>' . $t['name'] . '</option>';
            }
        }
        $adsense .= '</select>';
        return '<tr>
                    <th>' . lang('265') . ':</th>
                    <td>
                    <input type="text" class="input-text" size="10" name="data[setting][option][width]" value="' . $option['width'] . '">
					<div class="onShow">' . lang('290') . '</div>
                    </td>
                </tr>
				<tr>
                    <th>' . lang('283') . ':</th>
                    <td>
                    <input id="field_default_value" type="text" class="input-text" size="10" value="' . $option['size'] . '" name="data[setting][option][size]">
					<div class="onShow">' . lang('284') . '</div>
                    </td>
                </tr>
				<tr>
                    <th>' . lang('285') . ':</th>
                    <td>
                    <input type="text" class="input-text" size="40" name="data[setting][option][ext]" value="' . $option['ext'] . '">
					<div class="onShow">' . lang('286') . '</div>
                    </td>
                </tr>
				<tr>
                    <th>' . lang('287') . ':</th>
                    <td>
                    <input type="text" class="input-text" size="50" name="data[setting][option][uploadpath]" value="' . $option['uploadpath'] . '"><br>
					<font color="gray">' . lang('288') . '</font>
                    </td>
                </tr>
				<tr>
                    <th>' . lang('html-600') . ':</th>
                    <td>
					' . $adsense . '<div class="onShow">' . lang('html-601') . '</div>
                    </td>
                </tr>
				<tr>
                    <th>' . lang('html-597') . ':</th>
                    <td>' . $member . '</td>
                </tr>';
    }
				</tr>
				<?php 
                    if (is_array($group['level'])) {
                        $count = count($group['level']);
                        foreach ($group['level'] as $level) {
                            ?>
				<tr>
					<?php 
                            $id = $group['id'] . '_' . $level['id'];
                            ?>
					<td align="left">&nbsp;</td>
					<td align="left" style="padding-left:40px"><?php 
                            echo $level['name'];
                            ?>
&nbsp;&nbsp;<?php 
                            echo dr_show_stars($level['stars']);
                            ?>
</td>
					<td align="left">
					<label><?php 
                            echo lang('deny');
                            ?>
</label>&nbsp;<input class="dr_show" name="rule[<?php 
                            echo $id;
                            ?>
][show]" <?php 
                            if ($data['permission'][$id]['show']) {
                                ?>
checked<?php 
                            }
                            ?>
示例#4
0
    /**
     * 字段表单输入
     *
     * @param	string	$cname	字段别名
     * @param	string	$name	字段名称
     * @param	array	$cfg	字段配置
     * @param	string	$value	值
     * @return  string
     */
    public function input($cname, $name, $cfg, $value = NULL, $id = 0)
    {
        // 字段显示名称
        $text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>' : '') . '&nbsp;' . $cname . ':';
        // 表单附加参数
        $attr = isset($cfg['validate']['formattr']) && $cfg['validate']['formattr'] ? $cfg['validate']['formattr'] : '';
        // 字段提示信息
        $tips = isset($cfg['validate']['tips']) && $cfg['validate']['tips'] ? '<div class="onShow" id="dr_discount_tips">' . $cfg['validate']['tips'] . '</div>' : '<div class="onTime" id="dr_discount_tips"></div>';
        // 字段默认值
        $value = $value ? dr_string2array($value) : NULL;
        $str = '<input type="radio" name="data[discount][use]" onclick="$(\'#dr_div_discount\').hide()" value="0" ' . ($value ? '' : 'checked') . ' />&nbsp;不折扣&nbsp;&nbsp;&nbsp;&nbsp;';
        $str .= '<input type="radio" name="data[discount][use]" onclick="$(\'#dr_div_discount\').show()" value="1" ' . ($value ? 'checked' : '') . ' />&nbsp;折扣';
        $str .= '<div class="dr_format_wrap" id="dr_div_discount" style="margin-top:10px;' . ($value ? '' : 'display:none') . '"><table width="100%">';
        $MEMBER = $this->ci->get_cache('member');
        foreach ($MEMBER['group'] as $group) {
            if ($group['id'] > 2) {
                $str .= '<tr>';
                $str .= '	<td align="left" width="250">' . $group['name'] . '</td>';
                $str .= '	<td align="left"></td>';
                $str .= '</tr>';
                foreach ($group['level'] as $level) {
                    $id = $group['id'] . '_' . $level['id'];
                    $str .= '<tr>';
                    $str .= '<td align="left" width="250" style="padding-left:40px">' . $level['name'] . '&nbsp;&nbsp;' . dr_show_stars($level['stars']) . '</td>';
                    $str .= '<td align="left">';
                    $str .= '<input type="text" class="input-text" size="5" name="data[discount][' . $id . ']" value="' . $value[$id] . '" />';
                    $str .= '</td>';
                    $str .= '</tr>';
                }
            }
        }
        if (!defined('omooo_DATE_LD')) {
            $str .= '
			<link href="' . MEMBER_PATH . 'statics/js/calendar/jscal2.css" type="text/css" rel="stylesheet">
			<link href="' . MEMBER_PATH . 'statics/js/calendar/border-radius.css" type="text/css" rel="stylesheet">
			<link href="' . MEMBER_PATH . 'statics/js/calendar/win2k.css" type="text/css" rel="stylesheet">
			<script type="text/javascript" src="' . MEMBER_PATH . 'statics/js/calendar/calendar.js"></script>
			<script type="text/javascript" src="' . MEMBER_PATH . 'statics/js/calendar/' . SITE_LANGUAGE . '.js"></script>';
            define('omooo_DATE_LD', 1);
            //防止重复加载JS
        }
        $str .= '<tr>';
        $str .= '	<td colspan="2">开始时间:<input type="hidden" value="' . $value['star'] . '" name="data[discount][star]" id="dr_discount_star" />
		<input type="text" readonly="" class="date input-text" style="width:150px;" value="' . ($value['star'] ? date('Y-m-d H:i:s', $value['star']) : '') . '" id="calendar_discount_star" />
		<script type="text/javascript">
			Calendar.setup({
			weekNumbers : true,
			inputField  : "calendar_discount_star",
			trigger     : "calendar_discount_star",
			dateFormat  : "%Y-%m-%d %H:%M:%S",
			showTime    : true,
			minuteStep  : 1,
			onSelect    : function() {
				this.hide();
				var time = $("#calendar_discount_star").val();
				var date = (new Date(Date.parse(time.replace(/-/g,"/")))).getTime() / 1000;
				$("#dr_discount_star").val(date);
			}
			});
		</script><div class="onShow">必填选项</div></td>';
        $str .= '</tr>';
        $str .= '<tr>';
        $str .= '	<td colspan="2">结束时间:<input type="hidden" value="' . $value['end'] . '" name="data[discount][end]" id="dr_discount_end" />
		<input type="text" readonly="" class="date input-text" style="width:150px;" value="' . ($value['end'] ? date('Y-m-d H:i:s', $value['end']) : '') . '" id="calendar_discount_end" />
		<script type="text/javascript">
			Calendar.setup({
			weekNumbers : true,
			inputField  : "calendar_discount_end",
			trigger     : "calendar_discount_end",
			dateFormat  : "%Y-%m-%d %H:%M:%S",
			showTime    : true,
			minuteStep  : 1,
			onSelect    : function() {
				this.hide();
				var time = $("#calendar_discount_end").val();
				var date = (new Date(Date.parse(time.replace(/-/g,"/")))).getTime() / 1000;
				$("#dr_discount_end").val(date);
			}
			});
		</script><div class="onShow">必填选项</div></td>';
        $str .= '</tr>';
        $str .= '<tr>';
        $str .= '	<td colspan="2" style="border:none;color:#777777">折扣值不填写或者0表示不打折,例如1表示一折;9.5表示九五折</td>';
        $str .= '</tr>';
        $str .= '</table></div>';
        return $this->input_format($name, $text, $str);
    }
示例#5
0
 /**
  * 字段表单输入
  *
  * @param	string	$cname	字段别名
  * @param	string	$name	字段名称
  * @param	array	$cfg	字段配置
  * @param	string	$value	值
  * @return  string
  */
 public function input($cname, $name, $cfg, $value = NULL, $id = 0)
 {
     // 字段显示名称
     $text = (isset($cfg['validate']['required']) && $cfg['validate']['required'] == 1 ? '<font color="red">*</font>' : '') . '&nbsp;' . $cname . ':';
     // 表单附加参数
     $attr = isset($cfg['validate']['formattr']) && $cfg['validate']['formattr'] ? $cfg['validate']['formattr'] : '';
     // 字段提示信息
     $tips = isset($cfg['validate']['tips']) && $cfg['validate']['tips'] ? '<div class="onShow" id="dr_discount_tips">' . $cfg['validate']['tips'] . '</div>' : '';
     // 显示框宽度设置
     $width = isset($cfg['option']['width']) && $cfg['option']['width'] ? $cfg['option']['width'] : '80%';
     // 字段默认值
     $value = $value ? dr_string2array($value) : NULL;
     $str = '<input type="radio" name="data[' . $name . '][use]" onclick="$(\'#dr_div_' . $name . '\').hide()" value="0" ' . ($value ? '' : 'checked') . ' />&nbsp;<label>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
     $str .= '<input type="radio" name="data[' . $name . '][use]" onclick="$(\'#dr_div_' . $name . '\').show()" value="1" ' . ($value ? 'checked' : '') . ' />&nbsp;<label>开启</label>' . $tips;
     $str .= '<div class="dr_format_wrap" id="dr_div_' . $name . '" style="width:' . $width . (is_numeric($width) ? 'px' : '') . ';padding:5px;margin-top:10px;' . ($value ? '' : 'display:none') . '">';
     $str .= '<table width="100%">';
     $MEMBER = $this->ci->get_cache('member');
     foreach ($MEMBER['group'] as $group) {
         if ($group['id'] > 2) {
             $str .= '<tr>';
             $str .= '	<td align="left" width="250"><b>' . $group['name'] . '</b></td>';
             $str .= '	<td align="left"><b>' . SITE_SCORE . '</b></td>';
             $str .= '</tr>';
             foreach ($group['level'] as $level) {
                 $id = $group['id'] . '_' . $level['id'];
                 $str .= '<tr>';
                 $str .= '<td align="left" width="250" style="padding-left:40px">' . $level['name'] . '&nbsp;&nbsp;' . dr_show_stars($level['stars']) . '</td>';
                 $str .= '<td align="left">';
                 $str .= '<input type="text" class="input-text" style="width:70px;" name="data[' . $name . '][' . $id . ']" value="' . $value[$id] . '" />';
                 $str .= '</td>';
                 $str .= '</tr>';
             }
         }
     }
     $str .= '</tr>';
     $str .= '<tr>';
     $str .= '	<td colspan="2" style="border:none;color:#777777">' . SITE_SCORE . '不填写或者0表示免费,只能填写正整数值</td>';
     $str .= '</tr>';
     $str .= '</table>';
     $str .= '</div>';
     return $this->input_format($name, $text, $str);
 }