当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::HAS_DATA方法代码示例

本文整理汇总了PHP中Validator::HAS_DATA方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::HAS_DATA方法的具体用法?PHP Validator::HAS_DATA怎么用?PHP Validator::HAS_DATA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validator的用法示例。


在下文中一共展示了Validator::HAS_DATA方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: WALK_ARRAY

 public static function WALK_ARRAY($array, $return_data = false, $end = false)
 {
     $output = "";
     $output .= "<pre>";
     if (Validator::HAS_DATA($array)) {
         if (is_array($array)) {
             foreach ($array as $key => $data) {
                 if (!is_array($data)) {
                     $output .= $key . ' => ' . $data . '<br/>';
                 } else {
                     $output .= self::WALK_ARRAY($data, true);
                 }
             }
         }
     }
     $output .= "</pre>";
     if (!$return_data) {
         echo $output;
     } else {
         return $output;
     }
     if ($end) {
         Yii::app()->end();
     }
 }
开发者ID:edarkzero,项目名称:GineObs,代码行数:25,代码来源:DataShow.php

示例2: GET_USER

 public static function GET_USER($attribute = null)
 {
     if ($attribute != null) {
         return isset(Yii::app()->user->{$attribute}) ? Yii::app()->user->{$attribute} : null;
     } else {
         return Validator::HAS_DATA(Yii::app()->user) ? Yii::app()->user : null;
     }
 }
开发者ID:edarkzero,项目名称:GineObs,代码行数:8,代码来源:SessionManager.php

示例3: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $usersRol = UserRol::model()->findAll();
     if (!Validator::HAS_DATA($usersRol)) {
         throw new CHttpException('404', Yii::t('app', 'No data available'));
     }
     $s2_userRoles = array_merge(array('' => ''), ModelBase::GET_MODEL_ATTRIBUTE_VALUES_TO_ARRAY($usersRol, null, 'name'));
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $model->password = null;
     $this->render('update', array('model' => $model, 's2_userRoles' => $s2_userRoles));
 }
开发者ID:edarkzero,项目名称:PetAdoption,代码行数:24,代码来源:UserController.php

示例4: toHtmlValueTag

 public static function toHtmlValueTag($modelData, $tag, $valueAttr = null, $optionContentAttr, $emptyTag = true)
 {
     $html = "";
     $arrayCount = count($optionContentAttr) - 1;
     if (Validator::HAS_DATA($modelData)) {
         foreach ($modelData as $data) {
             $htmlContent = "";
             foreach ($optionContentAttr as $key => $oAttr) {
                 $htmlContent .= $data->{$oAttr};
                 if ($key < $arrayCount) {
                     $htmlContent .= ' ';
                 }
             }
             $htmlValue = $valueAttr != null ? 'value=' . '"' . $data->{$valueAttr} . '"' : '';
             $html .= '<' . $tag . ' ' . $htmlValue . '>' . $htmlContent . '</' . $tag . '>';
         }
     }
     if ($emptyTag) {
         $html = '<' . $tag . '></' . $tag . '>' . $html;
     }
     return $html;
 }
开发者ID:edarkzero,项目名称:GineObs,代码行数:22,代码来源:ModelDataParser.php

示例5: GET_MODEL_ATTRIBUTE_VALUES_TO_ARRAY

 /**
  * @param $CActiveRecord $model
  * @param $string $relation
  * @param $string $attribute
  * @return array
  */
 public static function GET_MODEL_ATTRIBUTE_VALUES_TO_ARRAY($model, $relation, $attribute, $appendAttr = NULL, $arrayKeyID = true)
 {
     $result = array();
     if ($relation != NULL) {
         if (is_array($model->{$relation})) {
             foreach ($model->{$relation} as $rel) {
                 $aux = !isset($appendAttr) ? $rel->{$attribute} : $rel->{$attribute} . ',' . $rel->{$appendAttr};
                 if ($arrayKeyID) {
                     $result[$rel->id] = $aux;
                 } else {
                     $result[] = $aux;
                 }
             }
         } else {
             foreach ($model as $data) {
                 $aux = !isset($appendAttr) ? $data->{$relation}->{$attribute} : $data->{$relation}->{$attribute} . ',' . $data->{$relation}->{$appendAttr};
                 if ($arrayKeyID) {
                     $result[$data->{$relation}->id] = $aux;
                 } else {
                     $result[] = $aux;
                 }
             }
         }
     } else {
         foreach ($model as $data) {
             $aux = !isset($appendAttr) ? $data->{$attribute} : $data->{$attribute} . ',' . $data->{$appendAttr};
             if ($arrayKeyID) {
                 $result[$data->id] = $aux;
             } else {
                 $result[] = $aux;
             }
         }
     }
     return Validator::HAS_DATA($result) ? $result : false;
 }
开发者ID:edarkzero,项目名称:PetAdoption,代码行数:41,代码来源:ModelBase.php

示例6: sendMail

 public static function sendMail($model = null, $message, $subject, $address = false, $reply = false)
 {
     $testing = Yii::app()->params['testing'];
     try {
         $mailer = Yii::createComponent('application.extensions.mailer.EMailer');
         if ($model != null) {
             foreach ($model->attributes as $key => $attribute) {
                 if (Validator::HAS_DATA($attribute) && $key != 'verifyCode') {
                     if ($key != 'file') {
                         $message .= '<div style="position: relative; overflow: hidden;"><p style="float: left;"><b>' . Yii::t('app', $key) . ': </b></p><p style="float: left; margin-left: 10px;max-width: 600px;">' . nl2br($attribute) . '</p></div><div style="clear: both;"></div>';
                     } else {
                         $mailer->AddAttachment($model->file->tempName, $model->file);
                     }
                 }
             }
         }
         if ($testing) {
             /*$mailer->IsSendmail();
               $mailer->Host = 'smtp.scripsanddeals.com';
               $mailer->Port = 25;
               $mailer->Username = 'master@scripsanddeals.com';
               $mailer->Password = '3Hon!8h0';
               $mailer->From = 'master@scripsanddeals.com';
               $mailer->FromName = 'Scrips&Deals';*/
             $mailer->SMTPAuth = true;
             $mailer->IsSMTP();
             $mailer->Host = 'ssl://smtp.gmail.com';
             $mailer->Port = 465;
             $mailer->Username = 'edgarcardona87@gmail.com';
             $mailer->Password = '1010060887zero1010';
             $mailer->From = 'santiagof4@gmail.com';
             $mailer->FromName = 'Scrips&Deals';
             $mailer->AddAddress('edgarcardona87@gmail.com');
         } else {
             $mailer->IsSendmail();
             $mailer->Host = 'smtp.scripsanddeals.com';
             $mailer->Port = 25;
             $mailer->Username = 'master@scripsanddeals.com';
             $mailer->Password = '3Hon!8h0';
             $mailer->From = 'master@scripsanddeals.com';
             $mailer->FromName = 'Scrips&Deals';
             if ($address) {
                 if (is_array($address)) {
                     foreach ($address as $add) {
                         $mailer->AddAddress($add);
                     }
                 } elseif (is_string($address)) {
                     $address = explode(';', $address);
                     foreach ($address as $add) {
                         $mailer->AddAddress($add);
                     }
                 }
             } else {
                 //$mailer->AddAddress('oferta_demanda@laofertaylademanda.com');
             }
             //$mailer->AddAddAddress('ecardona@aia-sc.com');
         }
         if ($reply) {
             if (is_array($reply)) {
                 foreach ($reply as $addReply) {
                     $mailer->AddReplyTo($addReply);
                 }
             } elseif (is_string($reply)) {
                 $reply = explode(';', $address);
                 foreach ($reply as $addReply) {
                     $mailer->AddReplyTo($addReply);
                 }
             }
         }
         $mailer->IsHTML(true);
         $mailer->CharSet = 'UTF-8';
         $mailer->Subject = $subject;
         $mailer->Body = $message;
         if (!$mailer->Send()) {
             error_log($mailer->ErrorInfo, 0);
             $result = "Hubo un inconveniente al enviar el correo.<br />" . $mailer->ErrorInfo . ". Por favor, inténtalo más tarde.";
             Yii::app()->user->setFlash('error', $result);
         } else {
             Yii::app()->user->setFlash('successMail', Yii::t('app', 'Your mail has been send successfully') . '.');
         }
     } catch (phpmailerException $e) {
         Yii::app()->user->setFlash('notice', $e->errorMessage());
         throw new CHttpException(403, $e->errorMessage());
     } catch (Exception $e) {
         Yii::app()->user->setFlash('notice', $e->getMessage());
         throw new CHttpException(403, $e->getMessage());
     }
 }
开发者ID:edarkzero,项目名称:YiiTest,代码行数:88,代码来源:Mail.php


注:本文中的Validator::HAS_DATA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。