本文整理匯總了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;
}