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


PHP Authority::model方法代码示例

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


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

示例1: getAuthByType

 private function getAuthByType($reg, $authtype, $lang)
 {
     if ($this->debug) {
         echo "Searching for: " . $authtype->type . " in " . $reg->name . "<br>";
     }
     $auth = Authority::model()->findAll("region_id=:region and type=:type and lang=:lang", array(":region" => $reg->id, ":type" => $authtype->id, ':lang' => $lang));
     if (count($auth)) {
         foreach ($auth as $au) {
             $result = $au;
             if ($this->debug) {
                 echo "Found: " . $au->name . " in " . $reg->name . "<br>";
             }
         }
     } else {
         if ($this->debug) {
             echo "Not Found: " . $authtype->type . " in " . $reg->name . "<br>";
         }
         $regP = $reg->parent;
         if ($regP != null) {
             if ($regP->id > 0) {
                 $result = $this->getAuthByType($regP, $authtype, $lang);
             }
         }
     }
     return $result;
 }
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:26,代码来源:AuthorityController.php

示例2: actionTranslate

 public function actionTranslate()
 {
     $sqlsm = "";
     $sqlm = "";
     $i = 0;
     $authorities = Authority::model()->findAll();
     foreach ($authorities as $r) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'authorities','authority_" . htmlentities($r->id, ENT_QUOTES, 'UTF-8') . "_charge');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($r->charge, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $numbers = Numbers::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 34;
     foreach ($numbers as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'numbers','numbers_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_field');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->field, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $services = Service::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 68;
     foreach ($services as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $modules = Module::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($modules as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $departments = Department::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 157;
     foreach ($departments as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','department_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $specialities = Speciality::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($specialities as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','speciality_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $news = News::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 229;
     foreach ($news as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $doctors = Doctor::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 406;
     foreach ($doctors as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_specialty');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->specialism, ENT_QUOTES, 'UTF-8') . "');<br>";
//.........这里部分代码省略.........
开发者ID:frankpaul142,项目名称:hospital-metropolitano,代码行数:101,代码来源:SiteController.php

示例3: actionRequestForm

 public function actionRequestForm($id)
 {
     $lang = $_POST['lang'];
     $holetype = $_POST['hole_type'];
     $auth = $_POST[$lang . '_auth'];
     $to_name = $_POST[$lang . '_to_name'];
     $to_address = $_POST[$lang . '_to_address'];
     $to_index = $_POST[$lang . '_to_index'];
     $from = $_POST[$lang . '_from'];
     $postaddress = $_POST[$lang . '_postaddress'];
     $signature = $_POST[$lang . '_signature'];
     $auth = Authority::model()->findByPk(array('id' => $auth, 'lang' => $lang));
     $model = $this->loadModel($id);
     $pics = array();
     $photos = "";
     $ulang = Yii::app()->user->getLanguage();
     if ($lang == "ru") {
         Yii::app()->setLanguage("ru");
         $lang = "ru";
     } else {
         Yii::app()->setLanguage("uk_ua");
         $lang = "ua";
     }
     $pics = array_keys($_POST['chpk']);
     setlocale(LC_ALL, 'ru_RU.UTF-8');
     $photos = "";
     $pnum = 1;
     $images = array();
     $model = $this->loadModel($id);
     if (count($model->requests_user) > 0) {
         $first = 1;
     } else {
         $first = 0;
     }
     if ($first != 0) {
         $pictures = $hole->pictures_fresh;
     } else {
         $pictures = $answ->files_img;
         $picPath = $model->requests_user[0]->answer->filesFolder . '/';
     }
     if ($_POST['map_ch'] === "on") {
         $photos = $photos . "<tr><td colspan=2>" . Yii::t('holes_view', 'Карта') . ' ' . Yii::t('holes_view', 'PICTURE_TO') . ' №' . $id . '<br><img height="500px" src="http://maps.googleapis.com/maps/api/staticmap?center=' . str_replace(',', '.', $model->LATITUDE) . ',' . str_replace(',', '.', $model->LONGITUDE) . '&zoom=14&size=400x400&markers=color:red%7Clabel:Дефект%7Cicon:http://ukryama.com/images/st1234/' . $model->type->alias . '_' . $model['STATE'] . '.png|' . str_replace(',', '.', $model->LATITUDE) . ',' . str_replace(',', '.', $model->LONGITUDE) . '&sensor=false"></td></tr><tr><td colspan=2 class="smv-spacer"></td></tr>' . "\n";
     }
     foreach ($model->pictures_fresh as $picture) {
         $pid = $picture->id;
         foreach ($pics as $pic) {
             if ($pic == $pid) {
                 if (!$first) {
                     $pfile = $picture->original;
                     $image = Yii::app()->image->load(Yii::getPathOfAlias('webroot') . $pfile);
                     if ($image->__get("height") > $image->__get("width")) {
                         $image->rotate(-90);
                         $fname = $pfile;
                         preg_match('/[^?]*/', $fname, $matches);
                         $string = $matches[0];
                         $pattern = preg_split('/\\./', $string, -1, PREG_SPLIT_OFFSET_CAPTURE);
                         $filenamepart = $pattern[count($pattern) - 1][0];
                         preg_match('/[^?]*/', $filenamepart, $matches);
                         $lastdot = $pattern[count($pattern) - 1][1];
                         $filename = substr($string, 0, $lastdot - 1);
                         $pfile = $filename . ".rotated." . $matches[0];
                         $image->save(Yii::getPathOfAlias('webroot') . $pfile);
                     }
                     if ($request->html) {
                         $photos = $photos . "<tr><td colspan=2>" . Yii::t('holes_view', 'PICTURE') . ' ' . $pnum . ' ' . Yii::t('holes_view', 'PICTURE_TO') . ' №' . $id . '<br><img height="500px" src="' . $pfile . '"></td></tr><tr><td colspan=2 class="smv-spacer"></td></tr>' . "\n";
                     } else {
                         $photos = $photos . "<tr><td colspan=2>" . Yii::t('holes_view', 'PICTURE') . ' ' . $pnum . ' ' . Yii::t('holes_view', 'PICTURE_TO') . ' №' . $id . '<br><img height="500px" src="data:image/jpg;base64,' . base64_encode(file_get_contents(Yii::getPathOfAlias('webroot') . $pfile)) . '"></td></tr><tr><td colspan=2 class="smv-spacer"></td></tr>' . "\n";
                     }
                 } else {
                     $pfile = $picPath . $picture->file_name;
                     if ($request->html) {
                         $photos = $photos . "<tr><td colspan=2>" . Yii::t('holes_view', 'PICTURE') . ' ' . $pnum . ' ' . Yii::t('holes_view', 'PICTURE_TO') . ' №' . $id . '<br><img height="500px" src="' . $pfile . '"></td></tr><tr><td colspan=2 class="smv-spacer"></td></tr>' . "\n";
                     } else {
                         $photos = $photos . "<tr><td colspan=2>" . Yii::t('holes_view', 'PICTURE') . ' ' . $pnum . ' ' . Yii::t('holes_view', 'PICTURE_TO') . ' №' . $id . '<br><img height="500px" src="data:image/jpg;base64,' . base64_encode(file_get_contents(Yii::getPathOfAlias('webroot') . $pfile)) . '"></td></tr><tr><td colspan=2 class="smv-spacer"></td></tr>' . "\n";
                     }
                 }
                 $pnum++;
             }
         }
     }
     $_data = array("ref" => "{$id}", "to_name" => $to_name, "to_address" => $to_address, "from_name" => $from, "from_address" => $postaddress, "when" => strftime("%e " . Yii::t('month', date("n")) . " %Y", $model->DATE_CREATED ? $model->DATE_CREATED : time()), "where" => $model->ADDRESS, "date" => strftime("%e " . Yii::t('month', date("n")) . " %Y", time()), "init" => $signature, "c_photos" => count($pics), "files" => $photos, "map" => 1);
     if (!$first) {
         $formType = $model->type['alias'];
     } else {
         $formType = "prosecutor2";
     }
     if ($_POST['print'] == "HTML") {
         header('Content-Type: text/html; charset=utf8', true);
         $printer = Yii::app()->Printer;
         //					echo $printer->printHTML($_data, $formType, $lang);
         $name = "{$formType}" . "_{$lang}";
         $tplname = YiiBase::getPathOfAlias($printer->params['templates']) . "/dyplates/" . $auth->atype->alias . "_" . $name . ".php";
         $css = file_get_contents(YiiBase::getPathOfAlias($printer->params['templates']) . "/dyplates/" . $auth->atype->alias . "_" . $formType . ".css");
         $html = $this->renderFile($tplname, $_data, true);
         $html = "<style>{$css}</style>\n{$html}";
         echo $html;
         return;
     } else {
         //print pdf
         $printer = Yii::app()->Printer;
//.........这里部分代码省略.........
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:101,代码来源:HolesController.php

示例4: array

<?php

$this->pageTitle = Yii::app()->params['langtitle'] . $model->name . 'Справочник ГАИ ';
$this->title = CHtml::link('Справочник ГАИ', array('index')) . ' > ' . $model->name;
?>
	<?php 
if (Yii::app()->getLanguage() == "ru") {
    $lang = "ru";
} else {
    $lang = "ua";
}
$param = "auth_" . $lang;
//		$auth=$model->$param->condition("type=:type",array(":type"=>2));
$auth = Authority::model()->find('region_id=:region and type=2 and lang=:lang', array(':region' => $model->id, ':lang' => $model->lang));
if ($auth) {
    ?>
		<div class="news-detail  sprav-detail">
		<?php 
    $this->renderPartial('_view_gibdd', array('data' => $auth));
    ?>
		</div>
		<br/><br/>
	<?php 
}
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:24,代码来源:view.php

示例5: getAuthByType

 public function getAuthByType($reg, $authtype, $lang)
 {
     $result = array();
     $auth = Authority::model()->findAll("region_id=:region and type=:type and lang=:lang", array(":region" => $reg->id, ":type" => $authtype, ':lang' => $lang));
     //		echo "Found ".count($auth)." of ".$authtype->alias." in ".$reg->name."<br>";
     if (count($auth)) {
         //если в данном регионе найдены органы нужного нам типа, то записываем их в массив и возвращаем его
         foreach ($auth as $au) {
             //				echo "Authority is: ".$au->name."<br>";
             array_push($result, $au);
         }
     } else {
         //иначе идем выше по регионам
         $regP = $reg->parent;
         //запрашиваем родительский регион
         if ($regP != null) {
             if ($regP->id > 0) {
                 $result = $this->getAuthByType($regP, $authtype, $lang);
             }
         }
     }
     return $result;
 }
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:23,代码来源:Holes.php


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