當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Place::validate方法代碼示例

本文整理匯總了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']));
 }
開發者ID:tecshuttle,項目名稱:51qsk,代碼行數:33,代碼來源:DefaultController.php

示例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']));
 }
開發者ID:tecshuttle,項目名稱:51qsk,代碼行數:27,代碼來源:DefaultController.php

示例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;
}
開發者ID:k-hasan-19,項目名稱:wiki,代碼行數:13,代碼來源:Place.php


注:本文中的Place::validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。