public static function header($form = array()) { if (isset($form['template'])) { form::$template = arr::take('template', $form); } $attrs['class'] = isset($form['class']) ? $form['class'] : 'form'; $attrs['method'] = isset($form['method']) ? $form['method'] : 'post'; $attrs['action'] = isset($form['action']) ? $form['action'] : url::current(); //加载表头 $html[] = ''; $html[] = '<form' . html::attributes($attrs) . '>'; $html[] = field::hidden(array('name' => '_REFERER', 'value' => request::referer())); $html[] = field::hidden(array('name' => '_FORMHASH', 'value' => form::hash())); //加载常用js $html[] = html::script(url::common() . '/js/jquery.validate.js'); $html[] = html::script(url::common() . '/js/jquery.validate.additional.js'); $html[] = html::script(url::common() . '/js/jquery.form.js'); //表单头部 if (isset($form['title']) || isset($form['description'])) { $html[] = '<div class="form-header clearfix">'; $html[] = isset($form['icon']) ? ' <div class="form-icon"></div>' : ''; $html[] = isset($form['title']) ? ' <div class="form-title">' . $form['title'] . '</div>' : ''; $html[] = isset($form['description']) ? ' <div class="form-description">' . $form['description'] . '</div>' : ''; $html[] = '</div>'; } //表单body部分开始 $html[] = '<div class="form-body">'; echo implode("\n", $html); }
public function actionDelete($id) { $file = zotop::model('zotop.file'); $delete = $file->delete($id); if ($delete) { msg::success('删除成功', request::referer()); } }
public static function header($header = array()) { if (isset($header['template'])) { form::$template = arr::take('template', $header); } $attrs['class'] = isset($header['class']) ? $header['class'] : 'form'; $attrs['method'] = isset($header['method']) ? $header['method'] : 'post'; $attrs['action'] = isset($header['action']) ? $header['action'] : url::current(); $html[] = ''; $html[] = '<form' . html::attributes($attrs) . '>'; $html[] = isset($header['title']) ? '<div class="form-title">' . $header['title'] . '</div>' : ''; $html[] = isset($header['description']) ? '<div class="form-description">' . $header['description'] . '</div>' : ''; $html[] = field::hidden(array('name' => '_REFERER', 'value' => request::referer())); $html[] = html::script(url::common() . '/js/jquery.validate.js'); $html[] = html::script(url::common() . '/js/jquery.validate.additional.js'); $html[] = html::script(url::common() . '/js/jquery.form.js'); $html[] = html::script(url::common() . '/js/zotop.form.js'); echo implode("\n", $html); }
public static function header($form = array()) { if (is_string($form)) { $form['description'] = $form; } form::$template = isset($form['template']) ? $form['template'] : form::$template; form::$globalid = isset($form['globalid']) ? $form['globalid'] : form::$globalid; //form 标签 $attrs['class'] = isset($form['class']) ? $form['class'] : 'form'; $attrs['method'] = isset($form['method']) ? $form['method'] : 'post'; $attrs['target'] = isset($form['target']) ? $form['target'] : ''; $attrs['action'] = isset($form['action']) ? $form['action'] : url::location(); if (isset($form['enctype']) || isset($form['upload'])) { $attrs['enctype'] = 'multipart/form-data'; } //加载表头 $html[] = ''; $html[] = '<form' . html::attributes($attrs) . '>'; $html[] = field::hidden(array('name' => '_REFERER', 'value' => request::referer())); $html[] = field::hidden(array('name' => '_FORMHASH', 'value' => form::hash())); $html[] = field::hidden(array('name' => '_GLOBALID', 'value' => form::globalid())); //加载常用js if ($form['valid'] !== false) { $html[] = html::script(ZOTOP_APP_URL_JS . '/jquery.validate.js'); } if ($form['ajax'] !== false) { $html[] = html::script(ZOTOP_APP_URL_JS . '/jquery.form.js'); } //表单头部 if (isset($form['title']) || isset($form['description'])) { $html[] = '<div class="form-header clearfix">'; $html[] = isset($form['title']) ? ' <div class="form-title">' . $form['title'] . '</div>' : ''; $html[] = isset($form['description']) ? ' <div class="form-description">' . $form['description'] . '</div>' : ''; $html[] = '</div>'; } //表单body部分开始 $html[] = '<div class="form-body">'; echo implode("\n", $html); }