本文整理汇总了PHP中Place::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::validate方法的具体用法?PHP Place::validate怎么用?PHP Place::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAddPlace
public function actionAddPlace()
{
$model = new Place();
$imageList = $this->_gets->getPost('imageList');
$imageListSerialize = XUtils::imageListSerialize($imageList);
if (isset($_POST['Place'])) {
$model->attributes = $_POST['Place'];
$model->host_id = $this->_user['hostId'];
$model->pic_other = $imageListSerialize['dataSerialize'];
$file = XUpload::upload($_FILES['attach']);
$adr = XUpload::upload($_FILES['pic_adr']);
if (is_array($file)) {
$model->pic = $file['pathname'];
@unlink($_POST['oAttach']);
@unlink($_POST['oThumb']);
}
// if ($model->pic == null){
// Yii::app()->user->setFlash('picMessage','主页图不能为空');
// }
if (is_array($adr)) {
$model->pic_adr = $adr['pathname'];
@unlink($_POST['oAttach']);
@unlink($_POST['oThumb']);
}
if ($model->pic_adr == null) {
Yii::app()->user->setFlash('picAdrMessage', '主图不能为空');
}
if ($model->validate() && $model->save()) {
$this->redirect(array('/host/default/myplace'));
}
}
$this->render('addplace', array('model' => $model, 'imageList' => $imageListSerialize['data']));
}
示例2: actionAddPlace
public function actionAddPlace()
{
$model = new Place();
$imageList = $this->_gets->getPost('imageList');
$imageListSerialize = XUtils::imageListSerialize($imageList);
if (isset($_POST['Place'])) {
$model->attributes = $_POST['Place'];
$model->host_id = $this->_user['hostId'];
$model->pic_other = $imageListSerialize['dataSerialize'];
$file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(192, 470)));
$adr = XUpload::upload($_FILES['pic_adr'], array('thumb' => true, 'thumbSize' => array(498, 364)));
if (is_array($file)) {
$model->pic = $file['paththumbname'];
@unlink($_POST['oAttach']);
@unlink($_POST['oThumb']);
}
if (is_array($adr)) {
$model->pic_adr = $adr['paththumbname'];
@unlink($_POST['oAttach']);
@unlink($_POST['oThumb']);
}
if ($model->validate() && $model->save()) {
$this->redirect(array('/host/default/myplace'));
}
}
$this->render('addplace', array('model' => $model, 'imageList' => $imageListSerialize['data']));
}
示例3: validatePlace
/**
* Callback function to validate data
* @return bool must return true or other hooks don't get called
*/
function validatePlace($editPage, $textBox1, $section, &$hookError)
{
$ns = $editPage->mTitle->getNamespace();
if ($ns == NS_PLACE) {
$place = new Place($editPage->mTitle->getText());
$place->validate($textBox1, $section, $hookError, true);
}
return true;
}