本文整理汇总了PHP中Call::form方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::form方法的具体用法?PHP Call::form怎么用?PHP Call::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Call
的用法示例。
在下文中一共展示了Call::form方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$model = new SettingsModel();
$form = Call::form('Index');
$countrysList = $model->getCountryList();
if (isPost()) {
if ($form->isValid(allPost()) and (isset($form->data["email"]) or isset($form->data["password"]) and isset($form->data["password1"]))) {
if (Request::getParam('user')->password == md5($form->data['password'])) {
$data = [];
if ($form->data['password1'] != '') {
$data['password'] = md5($form->data['password1']);
}
if (isset($form->data['email'])) {
$data['email'] = $form->data["email"];
}
if ($form->data['news'] == 1) {
$data['newsletter'] = $form->data["news"];
}
$model->setSettings(Request::getParam('user')->id, $data);
redirect(url('settings'));
}
} else {
$this->view->error = printError($form->error, 'INDEX_ERROR_');
}
}
$this->view->countrysList = $countrysList;
$this->view->title = Lang::translate('INDEX_TITLE');
}
示例2: lang_newsAction
public function lang_newsAction()
{
$model = new AdminModel();
$form = Call::form('Lang_news');
$news = $model->getNewsByID(Request::getUri()[0]);
if (!$news->id) {
error404();
}
if (isPost()) {
$dataPost = array('name' => post('name'), 'lang' => 'en', 'text' => post('text'));
// allPost()
$lnid = post('lnid', 'int');
if ($form->isValid($dataPost)) {
$data = $form->data;
$data['nid'] = $news->id;
$data['uid'] = Request::getParam('user')->id;
$data['time'] = time();
if ($lnid) {
$model->update('news_lang', $data, "`id` = '{$lnid}'");
setNotice(Lang::translate('LANG_NEWS_EDITED'));
} else {
$id = $model->insert('news_lang', $data);
$lnid = $id;
if ($id) {
setNotice(Lang::translate('LANG_NEWS_ADDED'));
}
}
$dataImg['path'] = 'public/news/';
$dataImg['new_name'] = $lnid;
$dataImg['resize'] = 2;
$dataImg['mkdir'] = true;
$dataImg['min_width'] = 600;
$dataImg['min_height'] = 400;
if ($_FILES['image']['name']) {
$f = File::LoadImg($_FILES['image'], $dataImg);
}
} else {
setNotice(Lang::translate('SOME_ERROR'));
}
//redirect(url('admin', 'lang_news', $news->id));
}
$this->view->list = $model->getLangNewsList($news->id);
$this->view->news = $news;
$this->view->title = $news->name;
}