Example #1
0
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     /*$users=array(
     			// username => password
     			'demo'=>'demo',
     			'admin'=>'admin',
     		);
     		if(!isset($users[$this->username]))
     			$this->errorCode=self::ERROR_USERNAME_INVALID;
     		elseif($users[$this->username]!==$this->password)
     			$this->errorCode=self::ERROR_PASSWORD_INVALID;
     		else
     			$this->errorCode=self::ERROR_NONE;
     		return !$this->errorCode;*/
     $user = UserAdmin::model()->find('LOWER(username)=?', array(strtolower($this->username)));
     if ($user == null) {
         $this->errorCOde = self::ERROR_USERNAME_INVALID;
     } else {
         if ($user->validatePassword($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->_id = $user->id_user;
             $this->username = $user->username;
             $this->errorCode = self::ERROR_NONE;
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
Example #2
0
 /**
  * Authenticates a Student.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent Student identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     if (strpos($this->username, "@")) {
         $user = UserAdmin::model()->findByAttributes(array('email' => $this->username));
     } else {
         $user = UserAdmin::model()->findByAttributes(array('username' => $this->username));
     }
     if ($user === null) {
         // No user found!
         //$this->errorCode = self::ERROR_USERNAME_INVALID;
         if (strpos($this->username, "@")) {
             $this->errorCode = self::ERROR_EMAIL_INVALID;
         } else {
             $this->errorCode = self::ERROR_USERNAME_INVALID;
         }
     } else {
         if ($user->password !== SHA1($this->password)) {
             // Invalid password!
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($user->status == 2) {
                 $this->errorCode = self::ERROR_STATUS_NOTACTIV;
             } else {
                 if ($user->status == 3) {
                     $this->errorCode = self::ERROR_STATUS_BAN;
                 } else {
                     if ($user->status == 4) {
                         $this->errorCode = self::ERROR_STATUS_EXPIRE;
                     } else {
                         // Okay!
                         Yii::app()->db->createCommand('UPDATE {{user_admin}} SET `lastvisitDate` = NOW() WHERE id=' . $user->id)->execute();
                         $this->errorCode = self::ERROR_NONE;
                         // Store the role in a session:
                         $this->setState('group', $user->group_id);
                         $this->setState('email', $user->email);
                         $this->setState('fullname', $user->name);
                         $this->setState('user_type', $user->user_type);
                         $this->_id = $user->id;
                         Yii::app()->db->createCommand('UPDATE {{yiisession}} SET `userId` = ' . $user->id . ', userType=1 WHERE id="' . session_id() . '"')->execute();
                     }
                 }
             }
         }
     }
     return !$this->errorCode;
 }
Example #3
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Mass Mail (<?php 
echo $model->subject;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', 'subject', array('name' => 'message_body', 'type' => 'raw', 'value' => $model->message_body), array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->created_by)), array('name' => 'created_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'modified_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->modified_by)), array('name' => 'modified_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified_on)))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #4
0
                                            <div class="profile-info-row">
                                                <div class="profile-info-name"> Expiry </div>

                                                <div class="profile-info-value">
                                                    <span><?php 
echo UserAdmin::get_date_time($model_profile->expiry);
?>
</span>
                                                </div>
                                            </div>
                                            <div class="profile-info-row">
                                                <div class="profile-info-name"> Birth Date </div>

                                                <div class="profile-info-value">
                                                    <span><?php 
echo UserAdmin::get_date_time($model_profile->birth_date);
?>
</span>
                                                </div>
                                            </div>
                                            <div class="profile-info-row">
                                                <div class="profile-info-name"> Status </div>
                                                <div class="profile-info-value">
                                                    <span><?php 
echo $model->UserStatus->status;
?>
</span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="hr hr-8 dotted"></div>
Example #5
0
<?php

namespace w34u\ssp;

require '../includeheader.php';
$cfg = \w34u\ssp\Configuration::getConfiguration();
if ($cfg->enableSetup !== true) {
    exit('Setup disabled, Enable in configuration, ->enableSetup');
}
$content = [];
if (!isset($_POST['SFC_Submit'])) {
    // set up database if not posting the form
    define('RUCKUSING_WORKING_BASE', getcwd());
    $db_config = (require RUCKUSING_WORKING_BASE . DIRECTORY_SEPARATOR . 'ruckusing.conf.php');
    if (isset($db_config['ruckusing_base'])) {
        define('RUCKUSING_BASE', $db_config['ruckusing_base']);
    } else {
        define('RUCKUSING_BASE', dirname(__FILE__));
    }
    require_once RUCKUSING_BASE . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.inc.php';
    $params = ['index.php', 'db:migrate'];
    $main = new \Ruckusing_FrameworkRunner($db_config, $params);
    $content['database_creation'] = $main->execute();
}
$session = new Protect();
$ssp = new Setup($session, true);
$admin = new UserAdmin($session, $ssp, '', 'sspsmalltemplate.tpl');
echo $admin->adminCreate($content);
Example #6
0
 /** 
  * If database error display results and perhaps exit program
  * @param string $errorString Error string from program attempting the database connection
  * @param string $query query that cause the error
  * @param array $values array of values passed to the query
  *
  * return - false on no error
  */
 function error($errorString, $query = "", $values = "")
 {
     global $session;
     $errorSql = false;
     if (!$this->db) {
         // database object is broken
         $errorSql = true;
         $error = "\nDatabase error " . date('d/m/Y H:i:s');
         $error .= "\nPackege Error: " . $errorString . "\nQuery: " . $query . "\n";
         $this->errorDescription = $error;
     } elseif ($this->db->ErrorNo() != 0) {
         // normal error
         $errorSql = true;
         $error = "\nDatabase error " . date('d/m/Y H:i:s');
         $error .= sprintf("\nRoutine producing error: %s\n", $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
         $error .= "\nPackege Error: " . $errorString . "\nQuery: " . $query . "\n";
         $error .= sprintf("ADODB Error: [%d]: %s\n", $this->db->ErrorNo(), $this->db->ErrorMsg());
         if (is_array($values) and count($values)) {
             "\nSql replacement arguments";
             "'" . implode("', '", $values) . "'\n";
         }
         if (trim($_SERVER['QUERY_STRING']) != "") {
             $error .= sprintf("\nQuery string: %s\n", $_SERVER['QUERY_STRING']);
         }
         if ($this->cfg->errorDisplayBacktrace) {
             $error .= "Debug backtrace\n";
             $backtrace = debug_backtrace();
             foreach ($backtrace as $routine) {
                 if (!isset($routine['file'])) {
                     // probably call_user_func
                     $error .= "call_user_func\n";
                 } else {
                     $error .= "Line " . $routine['line'] . " of " . $routine['file'] . "\n";
                     if (isset($routine['function'])) {
                         $error .= " In function " . $routine['function'] . "\n";
                         if (isset($routine['args']) and is_Array($routine['args'])) {
                             $error .= "  Arguments ";
                             foreach ($routine['args'] as $arg => $argValue) {
                                 if (is_array($argValue) or is_object($argValue)) {
                                     $argValue = serialize($argValue);
                                 }
                                 $error .= $arg . " = '" . $argValue . "' ";
                             }
                             $error .= "\n";
                         }
                     }
                 }
             }
         }
         $error .= sprintf("Users remote IP address: %s\n", $_SERVER['REMOTE_ADDR']);
         if (is_object($session) and $session->loggedIn) {
             // put in user info if available
             $userAdmin = new UserAdmin($session, '');
             $error .= sprintf("Users name: %s\n", $userAdmin->getName($session->userId, false));
             $error .= sprintf("Users id: %s\n", $session->userId);
         }
         $this->errorDescription = $error;
     }
     if ($errorSql) {
         $this->error = true;
         if ($this->cfg->displaySqlFaults) {
             echo '<head></head><body><pre>';
             echo $this->errorDescription;
             echo '</pre></body>';
         } else {
             error_log($error, $this->cfg->message_type, $this->cfg->errorLog);
             foreach ($this->cfg->errorAdmins as $toAddress => $toName) {
                 ECRIAmailer("SSP SQL error handler", $this->cfg->noReplyEmail, $toName, $toAddress, "SSP SQL error on " . $this->cfg->siteName, $error);
             }
         }
         if ($this->abortOnError) {
             die("<p>Database error: Information has been emailed to admin</p>");
         }
     }
     return $this->error;
 }
Example #7
0
<?php

$this->pageTitle = "Online Admin Users - " . Yii::app()->name;
$this->breadcrumbs = array('Online Admin Users' => array('admin'), 'Manage');
?>
<div class="widget-box">
    <div class="widget-header">
        <h5>Manage Online Admin Users</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_HOVER, 'id' => 'user-group-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'Name', 'name' => 'userId', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode(UserAdmin::get_user_name($data->userId)), array("/userAdmin/view","id"=>$data->userId))', 'filter' => CHtml::activeDropDownList($model, 'userId', CHtml::listData(UserAdmin::model()->findAll(array('condition' => '', "order" => "name")), 'id', 'name'), array('empty' => 'All')), 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Full Name')), array('name' => 'expire', 'type' => 'raw', 'value' => 'AuditTrail::returnInterval(OnlineUser::get_ts_time($data->expire),OnlineUser::get_current_time())'), array('header' => 'Shut down', 'type' => 'raw', 'value' => 'OnlineUser::shut_down($data->userId)', 'htmlOptions' => array('style' => "text-align:center;width:100px;")))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #8
0
$values = array();
$query = "CREATE TABLE `" . $SSP_Config->sessionTable . "` (\n  `SessionId` char(32) NOT NULL default '',\n  `UserId` char(32) NOT NULL default '',\n  `SessionTime` int(11) NOT NULL default '0',\n  `SessionName` varchar(30) NOT NULL default '',\n  `SessionIp` varchar(40) NOT NULL default '',\n  `SessionUserIp` varchar(40) NOT NULL default '',\n  `SessionCheckIp` tinyint(4) NOT NULL default '0',\n  `SessionRandom` int(11) NOT NULL default '0',\n  `SessionData` blob NOT NULL,\n  PRIMARY KEY  (`SessionId`),\n  KEY `SessionTime` (`SessionTime`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation;
$SSP_DB->query($query, $values, "SSP Database configuration: Creating session table");
$query = "CREATE TABLE `" . $SSP_Config->tokenTable . "` (\n  `token` char(32) NOT NULL default '',\n  `time` int(11) NOT NULL default '0',\n  `id` varchar(50) NOT NULL default '',\n  PRIMARY KEY  (`token`),\n  KEY `time` (`time`),\n  KEY `id` (`id`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation;
$SSP_DB->query($query, $values, "SSP Database configuration: Creating token table");
$query = "CREATE TABLE `" . $SSP_Config->userTable . "` (\n  `UserId` char(32) NOT NULL default '',\n  `UserEmail` varchar(255) NOT NULL default '',\n  `UserName` varchar(50) default NULL,\n  `UserPassword` varchar(255) NOT NULL default '',\n  `UserIp` varchar(30) NOT NULL default '',\n  `UserIpCheck` tinyint(4) NOT NULL default '0',\n  `UserAccess` varchar(20) NOT NULL default 'public',\n  `lang` varchar(10) NOT NULL default '',\n  `country` varchar(10) NOT NULL default '',\n  `UserDateLogon` int(11) NOT NULL default '0',\n  `UserDateLastLogon` int(11) NOT NULL default '0',\n  `UserDateCreated` int(11) NOT NULL default '0',\n  `UserDisabled` tinyint(4) NOT NULL default '0',\n  `UserPending` tinyint(4) NOT NULL default '0',\n  `UserAdminPending` tinyint(4) NOT NULL default '0',\n  `CreationFinished` tinyint(4) NOT NULL default '0',\n  `UserWaiting` tinyint(4) NOT NULL default '0',\n  `UserInvisible` tinyint(4) NOT NULL default '0',\n  PRIMARY KEY  (`UserId`),\n  KEY `UserEmail` (`UserEmail`),\n  UNIQUE KEY `UserName` (`UserName`),\n  KEY `UserPassword` (`UserPassword`),\n  KEY `UserDisabled` (`UserDisabled`,`UserPending`,`UserAdminPending`,`CreationFinished`,`UserWaiting`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation;
$SSP_DB->query($query, $values, "SSP Database configuration: Creating login table");
$query = "CREATE TABLE `" . $SSP_Config->userMiscTable . "` (\n  `UserId` char(32) NOT NULL default '',\n  `Title` varchar(15) NOT NULL default '',\n  `FirstName` varchar(20) NOT NULL default '',\n  `Initials` varchar(5) NOT NULL default '',\n  `FamilyName` varchar(30) NOT NULL default '',\n  `Address` varchar(255) NOT NULL default '',\n  `TownCity` varchar(30) NOT NULL default '',\n  `PostCode` varchar(10) NOT NULL default '',\n  `County` varchar(20) NOT NULL default '',\n  `Country` varchar(5) NOT NULL default '',\n  PRIMARY KEY  (`UserId`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation;
$SSP_DB->query($query, $values, "SSP Database configuration: Creating user misc data table");
$query = "CREATE TABLE `" . $SSP_Config->responseTable . "` (\n  `token` char(32) NOT NULL default '',\n  `time` int(11) NOT NULL default '0',\n  `UserId` char(32) NOT NULL default '',\n  PRIMARY KEY  (`token`),\n  KEY `time` (`time`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation;
$SSP_DB->query($query, $values, "SSP Database configuration: Creating user misc data table");
$query = "CREATE TABLE `" . $SSP_Config->tableRememberMe . "` (\n  `id` char(32) NOT NULL default '',\n  `user_id` char(32) NOT NULL default '',\n  `date_expires` int(11) NOT NULL default '0',\n  PRIMARY KEY  (`id`),\n  KEY `date_expires` (`date_expires`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation;
$SSP_DB->query($query, $values, "SSP Database configuration: Creating remember me table");
$session = new Protect();
$ssp = new Setup($session);
$admin = new UserAdmin($session, $ssp);
$admin->adminCreate();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--
Site by w34u
http://www.w34u.com
info@w34u.com
 + 44 (0)1273 201344
 + 44 (0)7833 512221
 -->
<title>SSP Database creation</title>
<meta name="Generator" content="EditPlus" />
<meta name="Author" content="w34u - Julian Blundell" />
Example #9
0
 public function ProfileUpdate($id)
 {
     $rules = array('correo' => 'required|email', 'archivo' => 'image|size:1024', 'telefono' => 'required', 'cargo' => 'required');
     $alertas = array('archivo.image' => 'El archivo tiene que ser una imagen');
     $validator = Validator::make(Input::all(), $rules, $alertas);
     if ($validator->fails()) {
         Session::flash('alerta', 'Error al actualizar la informacion del usuario');
         return Redirect::back()->withErrors($validator);
     } else {
         $usuario = User::find($id);
         if (Input::hasFile('archivo')) {
             Input::file('archivo')->move('img/' . date('j-n-y') . '-' . $usuario->username . '-' . Input::file("archivo")->getClientOriginalName());
             $file = date('j-n-y') . '-' . $usuario->username . '-' . Input::file("archivo")->getClientOriginalName();
             $usuario->img = $file;
         }
         $usuario->correo = Input::get('correo');
         if ($usuario->save()) {
             $Datos = UserAdmin::where('id_usuario', $id)->first();
             $Datos->nombre = Input::get('nombre');
             $Datos->telefono = Input::get('telefono');
             $Datos->cargo = Input::get('cargo');
             if ($Datos->save()) {
                 $bitacora = new Bitacora();
                 $bitacora->id_user = Auth::user()->id;
                 $bitacora->ip_maquina = Request::getClientIp();
                 $bitacora->nombre_pc = gethostbyaddr(Request::getClientIp());
                 $bitacora->concepto = "Profile Update";
                 $bitacora->descripcion = 'El usuario: ' . $usuario->username . ' | ' . $Datos->nombre . ', actualizo los datos de su perfil';
                 if ($bitacora->save()) {
                     Session::flash('mensaje', 'Datos del usuario ' . $usuario->username . ' actualizados correctamente');
                     return Redirect::back();
                 }
             }
         }
     }
 }
Example #10
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Banner (<?php 
echo $model->name;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'catid', 'type' => 'raw', 'value' => Banner::getCategoryName($model->catid)), array('name' => 'name', 'type' => 'raw', 'value' => $model->name, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'alias', 'type' => 'raw', 'value' => $model->alias, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'banner', 'type' => 'raw', 'value' => CHtml::image(Yii::app()->baseUrl . '/uploads/banners/' . $model->banner, $model->name, array('class' => '', 'title' => $model->name))), 'clickurl', array('name' => 'description', 'type' => 'raw', 'value' => $model->description, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"), array('name' => 'sticky', 'value' => $model->published ? "Yes" : "No"), 'ordering', array('name' => 'created_on', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'created_by', 'type' => 'raw', 'value' => Banner::getUserName($model->created_by)), array('name' => 'publish_up', 'value' => UserAdmin::get_date_time($model->publish_up)), array('name' => 'publish_down', 'value' => UserAdmin::get_date_time($model->publish_down)))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #11
0
 public function UpdateSector($id)
 {
     $Sector = Sectores::find($id);
     $rules = array('bas_id_sector' => 'required', 'tec_tipo' => 'required', 'banda' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         Session::flash('alerta', 'Error al actualizar los datos del sitio');
         return Redirect::back()->withErrors($validator);
     } else {
         $Sector->bas_id_sector = Input::get('bas_id_sector');
         $Sector->bas_ci = Input::get('bas_ci');
         $Sector->bas_id_dwh = Input::get('bas_id_dwh');
         $Sector->estado = Input::get('estado');
         $Sector->banda = Input::get('banda');
         $Sector->scr_bcch = Input::get('scr_bcch');
         $Sector->lac = Input::get('lac');
         $Sector->ant_mod = Input::get('ant_mod');
         $Sector->sec_fis = Input::get('sec_fis');
         $Sector->geo_azimuth = Input::get('geo_azimuth');
         $Sector->geo_alt_rad = Input::get('geo_alt_rad');
         $Sector->geo_titl_e = Input::get('geo_titl_e');
         $Sector->geo_titl_m = Input::get('geo_titl_m');
         $Sector->tec_tipo = Input::get('tec_tipo');
         if ($Sector->save()) {
             $bitacora = new Bitacora();
             $bitacora->id_user = Auth::user()->id;
             $bitacora->ip_maquina = Request::getClientIp();
             $bitacora->nombre_pc = gethostbyaddr(Request::getClientIp());
             $bitacora->concepto = "Update Sector: " . $Sector->bas_id_sector;
             $bitacora->descripcion = 'El usuario: ' . Auth::user()->username . ' | ' . UserAdmin::find(Auth::user()->id)->nombre . ', actualizo la informacion del sitio: ' . $Sector->bas_id_sector;
             if ($bitacora->save()) {
                 Session::flash('mensaje', 'Informacion del Sector ' . $Sector->bas_id_sector . ', actualizada correctamente');
                 return Redirect::to('/Optimizacion/Catalogo/Sectores');
             }
         }
     }
 }
Example #12
0
 static function addEntry($form)
 {
     $transaction = NULL;
     $result = array();
     $userId = null;
     $user = null;
     $newUser = false;
     $userExists = SecurityManager::isValidUser();
     try {
         $transaction = GenericDao::beginTransaction();
         if (!$userExists) {
             $step = Phinq::create($form->steps)->single(function ($item) {
                 return isset($item->disabled) && $item->disabled == true;
             });
             $mail = Phinq::create($step->controls)->single(function ($item) {
                 return $item->columnName == 'mail';
             })->value;
             $nombre = Phinq::create($step->controls)->single(function ($item) {
                 return $item->columnName == 'nombre';
             })->value;
             $apellido = Phinq::create($step->controls)->single(function ($item) {
                 return $item->columnName == 'apellido';
             })->value;
             $user = UserAdmin::getUserByMail($mail);
             if ($user != null) {
                 $form->userId = $userId = $user->id;
             } else {
                 $newUser = true;
                 $password = substr(md5(uniqid()), 0, 8);
                 $userDto = new \stdClass();
                 $userDto->firstName = $nombre;
                 $userDto->lastName = $apellido;
                 $userDto->mail = $mail;
                 $userDto->type = UserType::client;
                 $userDto->password = $password;
                 $response = json_decode(SecurityAdmin::createUser($userDto, $transaction));
                 $form->userId = $userId = $response->data;
             }
             $form->confirmada = 'N';
         } else {
             $form->userId = $userId = SecurityManager::UserInfo()->id;
             $form->confirmada = 'S';
         }
         $form->ip = $_SERVER['REMOTE_ADDR'];
         $entryId = FormDao::addEntry($form, $transaction);
         $user = SecurityDao::getUserById($userId);
         $dwoo = new Core();
         if (!$userExists) {
             if (!$newUser) {
                 $user->logo = AppConfig::logoUrl;
                 $user->producto = BaseAdmin::getProductoSimple($form->productoId)->nombre;
                 $code = base64_encode($user->id . '|' . $user->createDate . '|' . $user->mail . '|' . $entryId . '|' . $form->productoId . '|' . $form->id);
                 $link = 'http://' . getenv('HTTP_HOST') . APP_FOLDER . '/views/client/Confirmacion.php?c=' . $code;
                 $user->link = $link;
                 $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/userSolicitudRequestConfirm.tpl', (array) $user);
                 Mail::Send($user->mail, 'Confirmación de solicitud', $template);
             } else {
                 $subject = 'Aladinnus, proceso de activación';
                 $code = base64_encode($user->id . '|' . $user->createDate . '|' . $user->mail . '|' . $entryId . '|' . $form->productoId . '|' . $form->id);
                 $link = 'http://' . getenv('HTTP_HOST') . APP_FOLDER . '/views/client/Activacion.php?c=' . $code;
                 $user->link = $link;
                 $userDto->logo = $user->logo = AppConfig::logoUrl;
                 $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/userActivation.tpl', (array) $user);
                 Mail::Send($user->mail, $subject, $template);
             }
         } else {
             //MAIL PROVEEDORES
             $usersProveedor = SecurityDao::getUsersProveedorByProductoId($form->productoId);
             foreach ($usersProveedor as $prov) {
                 FormAdmin::addProveedorEntry($prov->id, $form->id, $entryId, $user->id);
                 $prov->logo = AppConfig::logoUrl;
                 $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/providerNewSolicitud.tpl', (array) $prov);
                 Mail::Send($prov->mail, 'Nueva solicitud', $template);
             }
             //MAIL ADMINs
             $usersAdmin = SecurityDao::getUsersAdmin();
             $usersAdmin = Phinq::create($usersAdmin)->where(function ($user) {
                 return $user->enabled;
             })->toArray();
             foreach ($usersAdmin as $admin) {
                 $admin->logo = AppConfig::logoUrl;
                 $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/userAdminRequest.tpl', (array) $admin);
                 Mail::Send($admin->mail, 'Nueva solicitud', $template);
             }
             //MAIL USUARIO
             $user->logo = AppConfig::logoUrl;
             $user->producto = BaseAdmin::getProductoSimple($form->productoId)->nombre;
             $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/userRequest.tpl', (array) $user);
             Mail::Send($user->mail, 'Nueva solicitud', $template);
         }
         $transaction->commit();
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $result = array($ex->getMessage());
     }
     return $result;
 }
Example #13
0
 public static function get_user_type($user_id, $user_type)
 {
     if ($user_type == 0) {
         $value = User::model()->findByAttributes(array('id' => $user_id));
     } else {
         $value = UserAdmin::model()->findByAttributes(array('id' => $user_id));
     }
     if (empty($value->name)) {
         return 'Not set!';
     } else {
         return $value->name;
     }
 }
Example #14
0
<?php

/* @var $this AuditTrailController */
/* @var $model AuditTrail */
$this->pageTitle = 'Audit Trail Admin Users - ' . Yii::app()->name;
$this->breadcrumbs = array('Audit Trails Admin Users' => array('admin'), 'Manage');
?>
<div class="widget-box">
    <div class="widget-header">
        <h5>Audit Trail Admin Users</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'audit-trail-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'user_id', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode(UserAdmin::get_name($data->user_id)), array("/userAdmin/view","id"=>$data->user_id))', 'filter' => CHtml::activeDropDownList($model, 'user_id', CHtml::listData(UserAdmin::model()->findAll(array('condition' => '', "order" => "name")), 'id', 'name'), array('empty' => 'All')), 'htmlOptions' => array('style' => "text-align:left;width:250px;", 'title' => 'Name')), array('name' => 'login_time', 'type' => 'raw', 'value' => 'AuditTrail::get_date_time($data->login_time)', 'htmlOptions' => array('style' => "text-align:left;width:250px;", 'title' => 'Login time')), array('name' => 'logout_time', 'type' => 'raw', 'value' => 'AuditTrail::get_date_time($data->logout_time)', 'htmlOptions' => array('style' => "text-align:left;width:250px;", 'title' => 'Logout time')), array('header' => 'Duration', 'type' => 'raw', 'value' => 'AuditTrail::returnInterval($data->login_time,$data->logout_time)'), array('header' => 'Actions', 'template' => '{delete}', 'class' => 'bootstrap.widgets.TbButtonColumn', 'htmlOptions' => array('style' => "text-align:center;width:80px;", 'title' => 'Actions')))));
?>
 
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->               
Example #15
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Directory (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', array('name' => 'category', 'type' => 'raw', 'value' => DirectoryCategory::getDirectoryCategory($model->category)), 'title', 'address', 'postcode', array('name' => 'country', 'type' => 'raw', 'value' => Country::getCountry($model->country)), array('name' => 'state', 'type' => 'raw', 'value' => State::getState($model->state)), array('name' => 'city', 'type' => 'raw', 'value' => City::getCity($model->city)), array('name' => 'district', 'type' => 'raw', 'value' => District::getDistrict($model->district)), array('name' => 'thana', 'type' => 'raw', 'value' => Thana::getThana($model->thana)), 'telephone', 'mobile', 'email', 'fax', 'website', 'details', array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->created_by)), array('name' => 'created_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'modified_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->modified_by)), array('name' => 'modified_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified_on)), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"), 'hits')));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #16
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Weblink Category (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'parent_id', 'type' => 'raw', 'value' => $model->getCategoryName($model->parent_id)), 'title', 'alias', array('name' => 'description', 'type' => 'raw', 'value' => $model->description, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"), array('name' => 'created_by', 'type' => 'raw', 'value' => $model->getUserName($model->created_by)), array('name' => 'created_time', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_time)), array('name' => 'modified_by', 'type' => 'raw', 'value' => $model->getUserName($model->modified_by)), array('name' => 'modified_time', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified_time)))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #17
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Content (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'title', 'alias', array('name' => 'profile_picture', 'type' => 'raw', 'value' => CHtml::image(Yii::app()->baseUrl . '/uploads/images/' . $model->images)), array('name' => 'introtext', 'type' => 'raw', 'value' => $model->introtext, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'fulltext', 'type' => 'raw', 'value' => $model->fulltext, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'state', 'value' => $model->state ? "Yes" : "No"), array('name' => 'catid', 'type' => 'raw', 'value' => ContentCategory::getCategoryName($model->catid)), array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_name($model->created_by)), array('name' => 'created', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created)), array('name' => 'modified_by', 'type' => 'raw', 'value' => $model->getUserName($model->modified_by)), array('name' => 'modified', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified)), array('name' => 'publish_up', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->publish_up)), array('name' => 'publish_down', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->publish_down)), 'ordering', 'metakey', 'metadesc', 'hits', array('name' => 'featured', 'value' => $model->featured ? "Yes" : "No"))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #18
0
                                    <a href="#">
                                        See all messages
                                        <i class="icon-arrow-right"></i>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="light-blue">
                            <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                                <?php 
echo UserAdmin::get_profile_picture(Yii::app()->user->id);
?>
                                <span class="user-info">
                                    <small>Welcome,</small>
                                    <?php 
echo UserAdmin::get_name(Yii::app()->user->id);
?>
                                </span>
                                <i class="icon-caret-down"></i>
                            </a>
                            <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
                                <li>
                                    <?php 
echo CHtml::link('<i class="icon-pencil"></i> Edit Profile', array('userAdmin/update', 'id' => Yii::app()->user->id));
?>
                                </li>
                                <li>
                                    <?php 
echo CHtml::link('<i class="icon-lock"></i> Change Password', array('userAdmin/edit', 'id' => Yii::app()->user->id));
?>
                                </li>
Example #19
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
echo $form->dropDownListControlGroup($model, 'parent', CHtml::listData(DocumentCategory::model()->findAll(array('condition' => 'parent=0', "order" => "title")), 'id', 'title'), array('empty' => '--please select--', 'class' => 'span5'));
echo $form->textFieldControlGroup($model, 'title', array('class' => 'span5', 'maxlength' => 255));
echo $form->dropDownListControlGroup($model, 'published', array('' => 'All', '1' => 'Yes', '0' => 'No'), array('class' => 'span5'));
echo $form->dropDownListControlGroup($model, 'created_by', CHtml::listData(UserAdmin::model()->findAll(array('select' => 'id, name', 'condition' => '', "order" => "name")), 'id', 'name'), array('empty' => '--please select--', 'class' => 'span5'));
?>
<div class="form-actions">
    <?php 
echo TbHtml::submitButton('Search', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    <?php 
echo TbHtml::resetButton('Reset', array('color' => TbHtml::BUTTON_COLOR_INFO));
?>
</div>
<?php 
$this->endWidget();
Example #20
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Directory Category (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', array('name' => 'parent', 'type' => 'raw', 'value' => DirectoryCategory::getDirectoryCategory($model->parent)), 'title', 'details', array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_name($model->created_by)), array('name' => 'created_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #21
0
<?php

$this->pageTitle = 'Admin Visitors - ' . Yii::app()->name;
$this->breadcrumbs = array('Admin Visitors' => array('admin'), 'Manage');
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePicker(id, data) {\n    \$('#datepicker1').datepicker();\n    \$('#datepicker2').datepicker();\n}\n");
?>
<div class="widget-box">
    <div class="widget-header">
        <h5>Admin Visitors</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-trash"></i>', array('truncate'), array('data-rel' => 'tooltip', 'title' => 'Truncate Admin Data', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_HOVER, 'id' => 'visitor-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'user_id', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode(UserAdmin::get_user_name($data->user_id)), array("/userAdmin/view","id"=>$data->user_id))', 'filter' => CHtml::activeDropDownList($model, 'user_id', CHtml::listData(UserAdmin::model()->findAll(array('condition' => '', "order" => "name")), 'id', 'name'), array('empty' => 'All')), 'htmlOptions' => array('style' => "text-align:left;")), 'user_name', 'page_title', 'page_link', array('name' => 'server_time', 'value' => 'AuditTrail::get_date_time($data->server_time)', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'server_time', 'htmlOptions' => array('id' => 'datepicker2', 'size' => '10'), 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'defaultOptions' => array('showOn' => 'focus', 'dateFormat' => 'yy-mm-dd', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => false)), true), 'htmlOptions' => array('style' => "text-align:center;")), 'browser', 'visitor_ip', array('header' => 'Actions', 'template' => '{delete}', 'class' => 'bootstrap.widgets.TbButtonColumn'))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Example #22
0
<?php

/* @var $this ContentController */
/* @var $model Content */
$this->pageTitle = $model->title;
$this->breadcrumbs = array(ContentCategory::getCategoryName($model->catid) => array('content/category', 'id' => $model->catid), $model->title);
?>
<h1 class="blog-post-title"><?php 
echo $model->title;
?>
</h1>
<ul class="blog-post-info list-inline">
    <li>
        <i class="fa fa-clock-o"></i> 
        <span class="font-lato"><?php 
echo UserAdmin::get_date($model->created);
?>
</span>
    </li>
    <li>
        <i class="fa fa-folder-open-o"></i> 
        <?php 
echo CHtml::link('<span class="font-lato">' . ContentCategory::getCategoryName($model->catid) . '</span>', array('content/category', 'id' => $model->catid), array('class' => 'category'));
?>
            
    </li>
</ul>
<!-- IMAGE -->
<figure class="margin-bottom-20">
    <?php 
echo Content::get_picture_responsive($model->id);
Example #23
0
    <!-- IMAGE -->
    <figure class="margin-bottom-20">
        <?php 
echo Content::get_picture_responsive($data->id);
?>
    </figure>
    <h2>
        <?php 
echo CHtml::link($data->title, array('content/view', 'id' => $data->id), array('class' => ''));
?>
    </h2>
    <ul class="blog-post-info list-inline">
        <li>
            <i class="fa fa-clock-o"></i> 
            <span class="font-lato"><?php 
echo UserAdmin::get_date($data->created);
?>
</span>
        </li>
        <li>
            <i class="fa fa-folder-open-o"></i> 
            <?php 
echo CHtml::link('<span class="font-lato">' . ContentCategory::getCategoryName($data->catid) . '</span>', array('content/category', 'id' => $data->catid), array('class' => 'category'));
?>
            
        </li>
    </ul>
    <p style="font-size:16px;">
        <?php 
echo $this->text_cut($this->html2txt($data->introtext), 1000);
?>
Example #24
0
             echo json_encode(array('error' => 'true', 'error_message' => 'Student not found.'));
         }
     } else {
         echo json_encode(array('error' => 'true', 'error_message' => 'Not enough information were given.'));
     }
 } else {
     if ($resource[4] == "UserAdmin") {
         //useradmin
         if (isset($resource[5]) && $resource[5] != "") {
             //[5] => User Id || username
             $results = array();
             if ($method == "GET") {
                 if (is_numeric($resource[5])) {
                     $results['admin'] = UserAdmin::getUserById($resource[5]);
                 } else {
                     $results['admin'] = UserAdmin::getUserByUsername($resource[5]);
                 }
                 //if given is username
             }
             $row = $results['admin'];
             if ($row) {
                 echo json_encode($row);
             } else {
                 echo json_encode(array('error' => 'true', 'error_message' => 'Adminstrator not found.'));
             }
         } else {
             echo json_encode(array('error' => 'true', 'error_message' => 'Not enough information were given.'));
         }
     } else {
         if ($resource[4] == "Booking") {
             //booking
Example #25
0
 public static function get_popular_content()
 {
     $array = Content::model()->findAll(array('condition' => 'state=1', 'limit' => '10', 'order' => 'hits DESC'));
     echo '<ul style="padding-left:0px;">';
     foreach ($array as $key => $value) {
         echo '<div class="row tab-post">';
         echo '<div class="col-md-3 col-sm-3 col-xs-3">';
         echo '<a href="blog-sidebar-left.html">';
         echo Content::get_images($value['id']);
         echo '</a>';
         echo '</div>';
         echo '<div class="col-md-9 col-sm-9 col-xs-9">';
         echo CHtml::link($value['title'], array('content/view', 'id' => $value['id']), array('class' => 'tab-post-link'));
         echo '<small>' . UserAdmin::get_date($value['created']) . '</small>';
         echo '</div>';
         echo '</div>';
     }
     echo '</ul>';
 }
Example #26
0
 public static function get_picture_grid($id)
 {
     $value = UserAdmin::model()->findByAttributes(array('id' => $id));
     $filePath = Yii::app()->basePath . '/../uploads/profile_picture/' . $value->profile_picture;
     if (is_file($filePath) && file_exists($filePath)) {
         return CHtml::image(Yii::app()->baseUrl . '/uploads/profile_picture/' . $value->profile_picture, 'Profile Picture', array('alt' => $value->name, 'class' => 'nav-user-photo', 'title' => $value->name, 'style' => 'width:50px;'));
     } else {
         return CHtml::image(Yii::app()->baseUrl . '/uploads/profile_picture/profile.jpg', 'Profile Picture', array('alt' => $value->name, 'class' => 'nav-user-photo', 'title' => $value->name, 'style' => 'width:50px;'));
     }
 }
 /**
  * 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 = UserAdmin::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }