Inheritance: extends MX_Controller
Beispiel #1
0
 function Run()
 {
     //Load config
     $config = new Config();
     $config->Load();
     $displayManager = new DisplayManager();
     //Create Login Manager
     $loginManager = new LoginManager();
     $loginManager->Load();
     $loginFail = false;
     if ($loginManager->WantLogin()) {
         $loginFail = !$loginManager->TryLogin();
         if (!$loginFail) {
             header('location: index.php');
         }
     }
     if ($loginManager->WantLogout()) {
         $loginManager->Logout();
     }
     if (isset($_GET['want']) and $_GET['want'] == 'logo') {
         $logo = new Logo();
         $logo->Generate();
         return;
     } elseif (isset($_GET['want']) and $_GET['want'] == 'source') {
         $displayManager->DisplaySource();
     } else {
         if ($loginManager->IsLogged()) {
             $imageManager = new ImageManager();
             $images = $imageManager->GetImages();
             $displayManager->DisplayImagesPage($images);
         } else {
             $displayManager->DisplayLoginPage($loginFail);
         }
     }
 }
Beispiel #2
0
 /**
  * Gets the default picture to show, anyways
  *
  * @see Logo::getDefaultPicture()
  *
  * @return void
  */
 protected function getDefaultPicture()
 {
     //if we are here, we want to serve default logo
     $pic = new Logo();
     $this->file_path = $pic->getPath();
     $this->format = $pic->getFormat();
     $this->mime = $pic->getMime();
     //anyways, we have no custom print logo
     $this->custom = false;
 }
 function __construct()
 {
     adminGateKeeper();
     $logos = getEntities(array("type" => "Logo"));
     if ($logos) {
         foreach ($logos as $logo) {
             $logo->delete();
         }
     }
     $logo = new Logo();
     $logo->save();
     $logo->createAvatar();
     new SystemMessage("Your avatar has been uploaded.");
     forward("admin/logo");
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Logo::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #5
0
 /**
  * this function queries all logos and returns them in autocomplete
  */
 public static function getListOfTypeLogo($parameters)
 {
     $structuredKeys = array();
     $values = array();
     $keys = array();
     foreach (Logo::$rawLogos as $id => $array) {
         $object = new Logo();
         $object->setId($id);
         $object->setCompleteLogo();
         $keys[] = $id;
         $title = $array['alt'];
         $structuredKeys[$id] = array('id' => $id, 'object' => $object, 'title' => $title);
         $values[] = $title;
     }
     if (isset($parameters['forAutocompletion']) && $parameters['forAutocompletion']) {
         $a[] = $values;
         $a[] = $keys;
         return $a;
     } else {
         return $structuredKeys;
     }
 }
Beispiel #6
0
 public static function getLogos($arr)
 {
     if (!$arr) {
         return null;
     }
     foreach ($arr as $value) {
         $logos[] = Logo::getLogo($value);
     }
     if (isset($logos)) {
         return $logos;
     } else {
         return null;
     }
 }
Beispiel #7
0
 public function run()
 {
     if ($this->_oper == 'show_logo') {
         $criteria = new CDbCriteria();
         $criteria->condition = 'logo_id=1';
         $logo = Logo::model()->find($criteria);
         echo '<img src="http://' . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . '/uploads/multimidia/logo/1/' . $logo->logo_path . '">';
     }
     if ($this->_controller != 'site') {
         if ($this->_oper == 'show_js') {
             switch ($this->_controller) {
                 case $this->_controller == 'negociosavenda' && $this->_action == 'view':
                     echo '<script type="text/javascript" src="' . Yii::app()->request->baseUrl . '/js/abas.js"></script>';
                     break;
             }
         } elseif ($this->_oper == 'show_css') {
             switch ($this->_controller) {
                 case 'quemsomos':
                     echo '<link rel="stylesheet" type="text/css" href="' . Yii::app()->request->baseUrl . '/css/quem-somos.css" charset="utf-8" />';
                     break;
                     /*case 'negociosavenda':
                     	 echo '<link rel="stylesheet" type="text/css" href="'.Yii::app()->request->baseUrl.'/css/scroll-twitter.css" charset="utf-8" />';
                     	 break;*/
             }
         } elseif ($this->_oper == 'change_id_body') {
             switch ($this->_controller) {
                 case $this->_controller == 'quemsomos' && ($this->_action == 'index' || $this->_action == 'operacaosunbelt'):
                     echo 'sobre-sunbelt';
                     break;
                 case $this->_controller == 'quemsomos' && $this->_action == 'equipefranqueados':
                     echo 'sobre-equipe-franqueados';
                     break;
                 case $this->_controller == 'paginas' && ($this->_id_pagina == 56 || $this->_id_pagina == 58):
                     echo 'sobre-sunbelt';
                     break;
                 case $this->_controller == 'paginas' && $this->_id_pagina == 57:
                     echo 'sobre-equipe-franqueados';
                     break;
             }
         }
     }
 }
 /**
  * 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);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['submit'])) {
         $posts_1 = Configurations::model()->findByAttributes(array('id' => 1));
         $posts_1->config_value = $_POST['collegename'];
         $posts_1->save();
         $posts_2 = Configurations::model()->findByAttributes(array('id' => 2));
         $posts_2->config_value = $_POST['address'];
         $posts_2->save();
         $posts_3 = Configurations::model()->findByAttributes(array('id' => 3));
         $posts_3->config_value = $_POST['phone'];
         $posts_3->save();
         $posts_4 = Configurations::model()->findByAttributes(array('id' => 4));
         $posts_4->config_value = $_POST['attentance'];
         $posts_4->save();
         $posts_5 = Configurations::model()->findByAttributes(array('id' => 13));
         $posts_5->config_value = $_POST['startyear'];
         $posts_5->save();
         $posts_6 = Configurations::model()->findByAttributes(array('id' => 14));
         $posts_6->config_value = $_POST['endyear'];
         $posts_6->save();
         $posts_7 = Configurations::model()->findByAttributes(array('id' => 14));
         $posts_7->config_value = $_POST['currency'];
         $posts_7->save();
         $posts_8 = Configurations::model()->findByAttributes(array('id' => 5));
         $posts_8->config_value = $_POST['currency'];
         $posts_8->save();
         $posts_9 = Configurations::model()->findByAttributes(array('id' => 6));
         $posts_9->config_value = $_POST['language'];
         $posts_9->save();
         if ($file = CUploadedFile::getInstance($model, 'logo')) {
             $logo = new Logo();
             $logo->photo_file_name = $file->name;
             $logo->photo_content_type = $file->type;
             $logo->photo_file_size = $file->size;
             $logo->photo_data = file_get_contents($file->tempName);
             $logo->save();
             $posts_10 = Configurations::model()->findByAttributes(array('id' => 18));
             $posts_10->config_value = Yii::app()->db->getLastInsertId();
             $posts_10->save();
         }
         $posts_11 = Configurations::model()->findByAttributes(array('id' => 12));
         $posts_11->config_value = $_POST['network'];
         $posts_11->save();
         $posts_12 = Configurations::model()->findByAttributes(array('id' => 7));
         $posts_12->config_value = $_POST['admission_number'];
         $posts_12->save();
         $posts_13 = Configurations::model()->findByAttributes(array('id' => 8));
         $posts_13->config_value = $_POST['employee_number'];
         $posts_13->save();
         $this->redirect(array('create'));
     }
     $this->render('update', array('model' => $model));
 }
Beispiel #9
0
.date_table{
	border:none;
}
</style>
<div class="atnd_Con" style="padding-left:20px; padding-top:30px;">
<?php 
if (isset($_REQUEST['id'])) {
    ?>
	 
	
    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
        <tr> 
            <td class="first">
                       <?php 
    $logo = Logo::model()->findAll();
    ?>
                        <?php 
    if ($logo != NULL) {
        //echo $logo[0]->photo_file_name;
        //Yii::app()->runController('Configurations/displayLogoImage/id/'.$logo[0]->primaryKey);
        echo '<img src="uploadedfiles/school_logo/' . $logo[0]->photo_file_name . '" alt="' . $logo[0]->photo_file_name . '" class="imgbrder" width="100%" />';
    }
    ?>
            </td>
            <td align="center" valign="middle" class="first">
            
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                    	<td class="listbxtop_hdng first" style="text-align:center;"></td>
                    </tr>
Beispiel #10
0
<?php

/* @var $this BiobankController */
/* @var $model Biobank */
try {
    $logo = isset($model->activeLogo) && $model->activeLogo != null && $model->activeLogo != "" ? Logo::model()->findByPk(new MongoId($model->activeLogo)) : null;
} catch (Exception $ex) {
    $logo = null;
    Yii::app()->user->setFlash('error', 'An error occured with logo, unable to display it');
}
?>
<div class="logoHeader">
    <h1>View Biobank #<?php 
echo $model->id;
?>
</h1>
    <div class="logo">
        <?php 
if ($logo != null) {
    echo $logo->toHtml();
}
?>
    </div>
</div>

<?php 
$attributes_oblig = array('identifier', 'name', 'collection_name', 'collection_id', 'biobank_class', 'diagnosis_available', array('name' => 'address', 'value' => nl2br($model->getAddress()), 'type' => 'raw'));
$attributes_facult = array('website');
$attributes_qualite = array('cert_ISO9001', 'cert_NFS96900', 'cert_autres', 'observations');
$attributes_diagnostic = array('A00-B99', 'C00-D48', 'D50-D89', 'E00-E90', 'F00-G99', 'H00-H59', 'H60-H95', 'I00-I99', 'J00-J99', 'K00-K93', 'L00-L99', 'M00-M99', 'N00-N99', 'O00-O99', 'P00-P96', 'Q00-Q99', 'R00-Z99');
$attributes_samples = array('sampling_disease_group', 'sampling_disease_group_code', 'keywords_MeSH');
Beispiel #11
0
<?php

// sample
@(include_once "class.logo.php");
@(include_once "class.logo.parser.php");
// Header
header("Content-Type: image/png");
$im = @imagecreatetruecolor(720, 600);
$canvas = new Logo(&$im, 255, 255, 255);
$canvas->setWrap(LOGO_WINDOW);
$textcolor = ImageColorAllocate($im, 0, 0, 0);
$canvas->setPC($textcolor);
$canvas->pd();
// Draw a star
$src = "repeat 5 [fd 100 rt 144]";
$errmsg = "https://SteakOverCooked.com";
$parser = new LogoParser(&$canvas);
$ret = $parser->parse($src);
$w = $parser->printWarnings();
$fs = $canvas->getFont();
imagestring($im, $fs, 0, $w, $parser->getMsg($ret), $canvas->getPC());
imagestring($im, $fs, 0, $w + imagefontheight($fs), $parser->getMemAndTime(), $canvas->getPC());
imagestring($im, 4, 0, imagesy($im) - imagefontheight(4), "(C) 2007~ ZHIHUA, LAI", $textcolor);
imagepng($im);
imagedestroy($im);
?>
 
Beispiel #12
0
 function Run()
 {
     $displayManager = new DisplayManager();
     if (isset($_GET['want']) and $_GET['want'] == 'logo') {
         $logo = new Logo();
         $logo->Generate();
         return;
     } elseif (isset($_GET['want']) and $_GET['want'] == 'source') {
         $displayManager->DisplaySource();
     } else {
         $displayManager->DisplaySitePage();
     }
 }
Beispiel #13
0
 /**
  * upload de l image dans la collection Mongo Logo
  * @return type
  */
 private function logoUpload()
 {
     if (Yii::app()->user->isAdmin()) {
         $biobank_id = $_SESSION['biobank_id'];
     } else {
         $biobank_id = Yii::app()->user->biobank_id;
     }
     $model = new Logo();
     $_SESSION['biobank_id'] = $biobank_id;
     if (isset($_FILES['Biobank'])) {
         $tempFilename = $_FILES["Biobank"]["tmp_name"]['vitrine']['logo'];
         $filename = $_FILES["Biobank"]["name"]['vitrine']['logo'];
         if ($_FILES['Biobank']['size']['vitrine']['logo'] < 1000000) {
             if (in_array(substr($filename, -4), array('.jpg', '.png')) || in_array(substr($filename, -5), array('.jpeg'))) {
                 $model->filename = $tempFilename;
                 $model->metadata['biobank_id'] = $biobank_id;
                 $model->uploadDate = new MongoDate();
                 if ($model->save()) {
                     $model->filename = $filename;
                     if ($model->save()) {
                         return $model->_id;
                     }
                 }
             } else {
                 Yii::app()->user->setFlash('error', "le fichier '{$filename}' n\\'est pas une image valide.");
             }
         } else {
             Yii::app()->user->setFlash('error', "le fichier '{$filename}' est trop volumineux.");
         }
     }
 }
Beispiel #14
0
 public function getLogos()
 {
     return Logo::get()->filter(array('Promote' => 1));
 }
 $imgPath = $history->img;
 $filePath = ".." . $imgPath . ".txt";
 if (is_file($filePath)) {
     /**
      * 处理完毕,更新数据库
      */
     $file = fopen($filePath, "r");
     if ($file) {
         $logoName = fgets($file);
         if ($logoName) {
             $logoName = trim(substr($logoName, 2));
             //根据logoName获取logoId
             $sql = "select * from " . TABLE_LOGO . " where `img`='{$logoName}' OR `moreImg` LIKE '{$logoName}'";
             $result = $mysql->query($sql);
             $value = $mysql->fetcharray($result);
             $logo = Logo::getLogo($value);
         } else {
             $logo = new Logo(-1, null, null, null, null, null);
         }
         if ($logo) {
             $sql = "UPDATE `" . TABLE_HISTORY . "` SET `logoId`={$logo->id},`isProcessing`=0 WHERE `id`={$history->id}";
             $mysql->query($sql);
             $affetctRows = $mysql->affectedrows();
             if ($affetctRows > 0) {
                 $history->logoId = $logo->id;
                 $history->processing = 0;
             }
         }
     }
     fclose($file);
     /**
Beispiel #16
0
 /**
  *
  * get the logo object for this biobank, null if not setted
  * @return Logo
  */
 public function getLogo()
 {
     $result = null;
     if (isset($this->vitrine) && isset($this->vitrine['logo'])) {
         $result = Logo::model()->findByPk(new MongoId($this->vitrine['logo']));
     }
     return $result;
 }
Beispiel #17
0
 private function storeLogo($logo, $biobank)
 {
     //  print_r($logo);
     $model = new Logo();
     $tempFilename = $logo["tmp_name"]['filename'];
     //$fileName = $logo["name"]['filename'];
     $ext = pathinfo($logo['name']['filename'], PATHINFO_EXTENSION);
     if (in_array($ext, array('jpg', 'png', 'jpeg'))) {
         $model->filename = $tempFilename;
         $model->metadata['biobank_id'] = (string) $biobank->_id;
         $model->uploadDate = new MongoDate();
         if ($model->save()) {
             $model->filename = 'logo' . $biobank->identifier . ".{$ext}";
             if ($model->save()) {
                 echo 'saved';
                 return $model->_id;
             } else {
                 echo 'not save second';
             }
         } else {
             echo 'not saved first';
         }
     }
 }
Beispiel #18
0
 function Run()
 {
     //Load config
     Config::SetInstance(new Config());
     Config::GetInstance()->Load();
     $albumManager = new AlbumManager();
     $album = new Album();
     $album->SetPath(Config::GetInstance()->GetPath());
     LinkManager::SetInstance(new LinkManager());
     LinkManager::GetInstance()->SetAlbum($album);
     $displayManager = new DisplayManager();
     //Create Login Manager
     $loginManager = new LoginManager();
     LoginManager::SetInstance($loginManager);
     $loginManager->Load();
     $loginFail = false;
     if ($loginManager->WantLogin()) {
         $loginFail = !$loginManager->TryLogin();
         if (!$loginFail) {
             header('location: ' . LinkManager::GetInstance()->Generate());
         }
     }
     if ($loginManager->WantLogout()) {
         $loginManager->Logout();
     }
     if (isset($_GET['want']) and $_GET['want'] == 'logo') {
         $logo = new Logo();
         $logo->Generate();
         return;
     } elseif (isset($_GET['want']) and $_GET['want'] == 'source') {
         $displayManager->DisplaySource();
     } elseif (isset($_GET['want']) and $_GET['want'] == 'help') {
         $displayManager->DisplayHelpPage();
     } else {
         if ($loginManager->IsAccessAllowed($album)) {
             $displayManager->DisplayImagesPage($album);
         } else {
             if ($loginManager->IsLogged()) {
                 $displayManager->DisplayAccessRefusedPage($album);
             } else {
                 $displayManager->DisplayLoginPage($album, $loginFail);
             }
         }
     }
 }
Beispiel #19
0
<?php

/**
 * Created by PhpStorm.哈哈
 * User: john
 * Date: 2015/9/18
 * Time: 19:34
 */
include_once "utils/Tables.php";
include_once "utils/MySql.php";
include_once "model/Logo.php";
define("QUERY_ALL", "SELECT `id`, `name`, `img`, `extra`, `category` FROM " . TABLE_LOGO);
define("QUERY_ID", "SELECT * FROM " . TABLE_LOGO . " WHERE id=");
if (is_array($_GET) && count($_GET) > 0) {
    if (isset($_GET["id"])) {
        $id = $_GET["id"];
    }
}
$mysql = new MySql();
if (isset($id)) {
    $result = $mysql->query(QUERY_ID . $id);
    $value = $mysql->fetcharray($result);
    echo Logo::getJson($value);
} else {
    $result = $mysql->query(QUERY_ALL);
    $arr = $mysql->fetchall($result);
    echo Logo::getJsons($arr);
}
Beispiel #20
0
    <script type="text/javascript">
  function clearText(field)
{
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
 }
</script>
</head>
<body>
<div class="loginimg"></div>
<div class="loginboxWrapper">
<div class="loginbox">
<!--<div class="sample_logo"></div>-->
<div class="sample_logo">
<?php 
$img = Logo::model()->findAll();
if (count($img) != 0) {
    foreach ($img as $img_1) {
        //echo '<img class="imgbrder" src="'.$this->createUrl('Configurations/DisplaySavedImage&id='.$img_1->primaryKey).'" alt="'.$img_1->photo_file_name.'" width="200" />';
    }
}
?>
</div>
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'login-content', 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true)));
?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%" height="15"><p>
        <?php 
echo $form->textField($model, 'username', array('class' => 'text-input', 'onblur' => 'clearText(this)', 'onfocus' => 'clearText(this)', 'value' => 'Username'));
Beispiel #21
0
 /**
  * @param SimpleXMLElement $parent
  * @param Logo             $logo
  */
 private function serializeLogo(SimpleXMLElement $parent, Logo $logo)
 {
     $imageXML = $parent->addChild('image');
     $imageXML->addChild('uri', $logo->getURI());
     $imageXML->addChild('link', $logo->getLink() ?: $feed->getURI());
     $imageXML->addChild('title', $logo->getTitle() ?: $feed->getTitle());
     $description = $logo->getDescription();
     $width = $logo->getWidth();
     $height = $logo->getHeight();
     if (!is_null($description)) {
         $imageXML->addChild('description', $description);
     }
     if (!is_null($width)) {
         $imageXML->addChild('width', $width);
     }
     if (!is_null($height)) {
         $imageXML->addChild('height', $height);
     }
 }
 /**
  * each biobank have 2 pages
  * @param type $pdf
  * @param type $model
  * @return type
  */
 public static function getPage($pdf, $model)
 {
     $pdf->AddPage();
     $pdf->Bookmark($model->name, 0, 0, '', 'B', array(0, 64, 128));
     $pdf->SetAutoPageBreak(TRUE, 10);
     //marge inferieure
     $pdf->Ln(4);
     $pdf->SetFont('timesB', '', 11);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Cell(0, 0, $model->name, 0, false, 'L', 0, '', 0, false, 'T', 'M');
     $pdf->Ln(4);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(0, 0, 'Identifiant BRIF : ' . $model->identifier, 0, false, 'L', 0, '', 0, false, 'T', 'M');
     $logo = isset($model->activeLogo) && $model->activeLogo != null && $model->activeLogo != "" ? Logo::model()->findByPk(new MongoId($model->activeLogo)) : null;
     if ($logo != null) {
         $pdf->Image($logo->toSimpleImage(), '', 16, 25, 10, '', '', '', true, 300, 'R');
     }
     $pdf->Ln(6);
     //affichage du cadre Coordinateur : addresse
     //color gold
     //espace vide d une ligne
     $pdf->Cell(0, 0, '', 0, 1, '', 0, '', 4);
     $pdf->SetFillColor(255, 215, 0);
     $pdf->SetFont('helvetica', 'B', 12);
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $pdf->RoundedRect($x = 10, $y = 35, $w = 190, $h = 30, $r = 3.5, $round_corner = '1111', $style = 'DF');
     //color red to text
     $pdf->SetTextColor(205, 0, 0);
     $pdf->MultiCell(90, 5, 'Coordinateur:', 0, 'L', 1, 0, '', '', false);
     $pdf->MultiCell(90, 5, 'Adresse:', 0, 'L', 1, 1, '', '', false);
     //color black text
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('helvetica', '', 10);
     $pdf->MultiCell(90, 2, $model->getShortContactInv() . "\n" . $model->getPhoneContact() . "\n" . $model->getEmailContact(), 0, 'L', 1, 0, '', '');
     $website = isset($model->website) ? $model->website : '';
     $pdf->MultiCell(90, 2, $model->getAddress() . "\n" . $website, 0, 'L', 1, 1, '', '');
     $pdf->Ln(7);
     //add each paragraph with title
     $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Présentation : ', isset($model->presentation) ? $model->presentation : '');
     $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Thématiques : ', isset($model->thematiques) ? $model->thematiques : '');
     $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Projets de recherche : ', isset($model->projetRecherche) ? $model->projetRecherche : '');
     $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Publications : ', isset($model->publications) ? $model->publications : '');
     $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Réseaux : ', isset($model->reseaux) ? $model->reseaux : '');
     $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Qualité : ', isset($model->qualite) ? $model->qualite : '');
     return $pdf;
 }