Ejemplo n.º 1
0
 /**
  * @param $exception \Exception
  */
 private function sendErrorMessageToDevelopers($exception)
 {
     $errors = $this->convertExceptionToArray($exception);
     $userIdentity = Yii::$app->getUser()->getIdentity();
     if (!is_null($userIdentity)) {
         $sender = [$userIdentity->getEmail() => $userIdentity->getFullname()];
     } else {
         $sender = ['noreply@' . Yii::$app->getRequest()->getServerName() => 'Web User'];
     }
     $status = S::get($errors, 'status');
     $status = is_null($status) ? S::get($errors, 'code') : $status;
     $subject = '#' . $status . ' ' . S::get($errors, 'name');
     $content = '<h3>' . Yii::$app->name . ' alkalmazásban hiba történt!</h3>';
     $absoluteUrl = Yii::$app->getRequest()->absoluteUrl;
     $content .= '<p><b>URL:</b> ' . $absoluteUrl . '</p>';
     $referrer = Yii::$app->getRequest()->getReferrer();
     $content .= '<p><b>Előző/Hivatkozó oldal:</b> ' . ($referrer !== null ? $referrer : 'direkt link') . '</p>';
     $content .= '<p><b>Fájl:</b> <code>' . $exception->getFile() . '</code></p>';
     $content .= '<p><b>Sor:</b> <code>' . $exception->getLine() . '</code></p>';
     $content .= '<p><b>Hibaüzenet</b> <code>' . $exception->getMessage() . '</code></p>';
     $content .= '<p><b>Részetesen:</b> ' . \yii\helpers\VarDumper::dumpAsString($errors, 10, true) . '</p>';
     $content .= '<p><b>GET paraméterek</b> ' . VarDumper::dumpAsString(Yii::$app->request->get(), 10, true) . '</p>';
     $content .= '<p><b>POST paraméterek</b> ' . VarDumper::dumpAsString(Yii::$app->request->post(), 10, true) . '</p>';
     foreach ($this->emails as $recipient) {
         Mailer::sendMail($recipient, $subject, $content, $sender);
     }
 }
Ejemplo n.º 2
0
 private static function setSender($from)
 {
     if (is_null($from)) {
         $from = S::get(Yii::$app->params, 'cms.email.owner');
         if (is_null($from)) {
             $from = self::getDefaultSenderAddress();
         }
     }
     return $from;
 }
Ejemplo n.º 3
0
 public static function dropDownFilterDynamic($modelClassName, $attributeName, $options = [], $filterByUser = false)
 {
     if (empty($options)) {
         $query = $modelClassName::find()->asArray()->select($attributeName)->distinct()->where($attributeName . ' IS NOT NULL')->orderBy($attributeName . ' ASC');
         if ($filterByUser) {
             $query->andWhere('created_user='******'itemsCategory');
         $dataProviderClass = S::get($options, 'dataProviderClass');
         if ($itemsCategory !== null && $dataProviderClass !== null) {
             $query = $modelClassName::find()->asArray()->select($attributeName)->distinct()->where($attributeName . ' IS NOT NULL')->orderBy($attributeName . ' ASC');
             if ($filterByUser) {
                 $query->andWhere('created_user='******'foreignClassName');
         $foreignKey = S::get($options, 'foreignKey', 'id');
         $foreignName = S::get($options, 'foreignName', 'name');
         if ($foreignClassName !== null) {
             $tblPrefixModel = $modelClassName::tableName() . '.';
             $tblPrefixForeign = $foreignClassName::tableName() . '.';
             $query = $modelClassName::find()->asArray()->select($tblPrefixModel . $attributeName . ' as id, ' . $tblPrefixForeign . $foreignName . ' as name')->distinct()->leftJoin($foreignClassName::tableName(), $tblPrefixModel . $attributeName . '=' . $tblPrefixForeign . $foreignKey)->where($tblPrefixModel . $attributeName . ' IS NOT NULL');
             if ($filterByUser) {
                 $query->andWhere($tblPrefixModel . 'created_user='******'id', 'name');
         }
     }
 }
Ejemplo n.º 4
0
 public static function getLabelByID($id)
 {
     $tag = self::findOne(['id' => $id]);
     return S::get($tag, 'label');
 }
Ejemplo n.º 5
0
 public function editable($type, $attribute, $source = [], $pluginOptions = [])
 {
     switch ($type) {
         case self::EDITABLE_TYPE_DROPDOWN:
             $compiledSource = S::get($pluginOptions, 'clientOptions.source');
             return Editable::select($attribute, $this->getPrimaryKey(), $this->{$attribute}, S::get($source, $this->{$attribute}), ['updatebyeditable'], !is_null($compiledSource) ? $compiledSource : $source, $pluginOptions);
             break;
         case self::EDITABLE_TYPE_TEXTINPUT:
             return Editable::input($attribute, $this->getPrimaryKey(), $this->{$attribute}, ['updatebyeditable'], $pluginOptions);
             break;
     }
 }