示例#1
0
 public function run()
 {
     $this->userinfo = User::model()->findByPk($this->userid);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "userid = '" . $this->userid . "' AND Iscompleted = 0";
     if ($this->userid != Yii::app()->session['login']['id']) {
         $Criteria->condition = "AND finao_status_Ispublic = 0";
     }
     $finaos = UserFinao::model()->findAll($Criteria);
     if (!empty($finaos)) {
         foreach ($finaos as $finaoids) {
             $ids[] = $finaoids->user_finao_id;
         }
         $Criteria = new CDbCriteria();
         $Criteria->group = 'tile_id';
         $Criteria->condition = "userid = '" . $this->userid . "'";
         if (!empty($ids)) {
             $Criteria->addInCondition('finao_id', $ids);
         }
         $Criteria->order = 'createddate DESC';
         $this->alltiles = UserFinaoTile::model()->findAll($Criteria);
     } else {
         $this->alltiles = "";
     }
     $uploadtypeimage = Lookups::model()->findByAttributes(array('lookup_name' => 'Image', 'lookup_type' => 'uploadtype', 'lookup_status' => 1));
     //$uploadsourcetypeimage = Lookups::model()->findByAttributes(array('lookup_type'=>'uploadsourcetype','lookup_name'=>'finao','lookup_status'=>1));
     $uploadtypevideo = Lookups::model()->findByAttributes(array('lookup_name' => 'Video', 'lookup_type' => 'uploadtype', 'lookup_status' => 1));
     //$uploadsourcetypevideo = Lookups::model()->findByAttributes(array('lookup_type'=>'uploadsourcetype','lookup_name'=>'finao','lookup_status'=>1));
     $images = Uploaddetails::model()->findAllByAttributes(array('uploadtype' => $uploadtypeimage->lookup_id, 'uploadedby' => $this->userid, 'status' => 1));
     $videos = Uploaddetails::model()->findAllByAttributes(array('uploadtype' => $uploadtypevideo->lookup_id, 'uploadedby' => $this->userid, 'status' => 1));
     $this->imgcount = count($images);
     $this->videocount = count($videos);
     $this->render('_topheader', array('tilescount' => count($this->alltiles), 'userinfo' => $this->userinfo, 'finaocount' => count($finaos), 'imgcount' => $this->imgcount, 'videocount' => $this->videocount));
 }
示例#2
0
 public function run()
 {
     $this->selheader = "register";
     $model = new User();
     $gender = Lookups::model()->findAllByAttributes(array('lookup_type' => 'UIValues-Gender'));
     $gender2 = CHtml::listData($gender, 'lookup_id', 'lookup_name');
     $this->render('_regform', array('gender' => $gender2, 'model' => $model));
 }
示例#3
0
文件: tiles.php 项目: gopi158/Sample
 public function run()
 {
     /*$userid = Yii::app()->session['login']['id'];
     
     		//$userid = Yii::app()->session['login']['id'];
     
     		$criteria=new CDbCriteria;
     
             $criteria->distinct = true;
     
     		$criteria->condition = "userid = '".$userid."'";
     
     		$alltiles = UserFinaoTile::model()->findAll($criteria);*/
     if (isset($this->homepage)) {
         $userid = Yii::app()->session['login']['id'];
         $this->userinfo = User::model()->findByPk($userid);
         $widstyle = 'notile';
         $Criteria = new CDbCriteria();
         $Criteria->condition = "userid = '" . $userid . "' AND Iscompleted = 0";
         $finaos = UserFinao::model()->findAll($Criteria);
         if (!empty($finaos)) {
             $Criteria = new CDbCriteria();
             $Criteria->group = 'tile_id';
             $Criteria->condition = "userid = '" . $userid . "'";
             /*if(isset($_REQUEST['frndid']))
             
             				{*/
             if (!empty($finaos)) {
                 foreach ($finaos as $finaoids) {
                     $ids[] = $finaoids->user_finao_id;
                 }
             }
             if (!empty($ids)) {
                 $Criteria->addInCondition('finao_id', $ids);
             }
             /*}*/
             $Criteria->order = 'createddate DESC';
             $this->alltiles = UserFinaoTile::model()->findAll($Criteria);
         } else {
             $this->alltiles = "";
         }
         $uploadtypeimage = Lookups::model()->findByAttributes(array('lookup_name' => 'Image', 'lookup_type' => 'uploadtype', 'lookup_status' => 1));
         //$uploadsourcetypeimage = Lookups::model()->findByAttributes(array('lookup_type'=>'uploadsourcetype','lookup_name'=>'finao','lookup_status'=>1));
         $uploadtypevideo = Lookups::model()->findByAttributes(array('lookup_name' => 'Video', 'lookup_type' => 'uploadtype', 'lookup_status' => 1));
         //$uploadsourcetypevideo = Lookups::model()->findByAttributes(array('lookup_type'=>'uploadsourcetype','lookup_name'=>'finao','lookup_status'=>1));
         $images = Uploaddetails::model()->findAllByAttributes(array('uploadtype' => $uploadtypeimage->lookup_id, 'uploadedby' => $userid, 'status' => 1));
         $videos = Uploaddetails::model()->findAllByAttributes(array('uploadtype' => $uploadtypevideo->lookup_id, 'uploadedby' => $userid, 'status' => 1));
         $this->imgcount = count($images);
         $this->videocount = count($videos);
         $this->totaltilecount = count($this->alltiles);
     }
     if ($this->widgetstyle == 'tile') {
         $this->render('_tile', array('alltiles' => $this->alltiles, 'userinfo' => $this->userinfo, 'totaltilecount' => $this->totaltilecount, 'imgcount' => $this->imgcount, 'videocount' => $this->videocount));
     } else {
         $this->render('_tilenotumb', array('alltiles' => $this->alltiles, 'userinfo' => $this->userinfo, 'totaltilecount' => $this->totaltilecount, 'imgcount' => $this->imgcount, 'videocount' => $this->videocount));
     }
 }
示例#4
0
 /**
  * Get values from lookups table
  * and store it in cache to fix N+1 problem
  *
  * @return string
  * @author Gat
  **/
 public static function getLookupValue($key, $id)
 {
     if (Cache::has("{$key}_{$id}")) {
         return Cache::get("{$key}_{$id}");
     }
     $lookupValue = Lookups::whereKey($key)->whereKeyId($id)->first()->value;
     // Set expiry for 1 day
     $duration = Carbon::now()->addDay();
     // Store in cache
     Cache::put("{$key}_{$id}", $lookupValue, $duration);
     return $lookupValue;
 }
示例#5
0
 public function run()
 {
     switch ($this->type) {
         case 'group':
             $resultinfo = Group::model()->findByAttributes(array('group_id' => $this->pid));
             break;
         case 'tile':
             $resulttileinfo = Lookups::model()->findByAttributes(array('lookup_id' => $this->pid));
             break;
         case 'video':
             $resultgroupinfo = '';
             break;
     }
     $this->render('_easyregister', array('type' => $this->type, 'pid' => $this->pid, 'resultinfo' => $resultinfo, 'resulttileinfo' => $resulttileinfo));
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 3) as $index) {
         Lookups::create(['key' => 'industry_type', 'key_id' => $index, 'value' => 'Option ' . $index]);
     }
     // Contact number types - Contact numbers
     Lookups::create(['key' => 'customer_status', 'key_id' => 1, 'value' => 'Active']);
     Lookups::create(['key' => 'customer_status', 'key_id' => 2, 'value' => 'Inactive']);
     // Contact number types - Contact numbers
     Lookups::create(['key' => 'contact_no_type', 'key_id' => 1, 'value' => 'Mobile']);
     Lookups::create(['key' => 'contact_no_type', 'key_id' => 2, 'value' => 'Work']);
     Lookups::create(['key' => 'contact_no_type', 'key_id' => 3, 'value' => 'Landline']);
     // Unit of Measurements - Quotations
     Lookups::create(['key' => 'unit_of_measurement', 'key_id' => 1, 'value' => 'Piece']);
     Lookups::create(['key' => 'unit_of_measurement', 'key_id' => 2, 'value' => 'Set']);
     Lookups::create(['key' => 'unit_of_measurement', 'key_id' => 3, 'value' => 'Lot']);
     // Type of work - Quotations
     Lookups::create(['key' => 'type_of_work', 'key_id' => 1, 'value' => 'Fabrication']);
     Lookups::create(['key' => 'type_of_work', 'key_id' => 2, 'value' => 'Repair']);
     Lookups::create(['key' => 'type_of_work', 'key_id' => 3, 'value' => 'Supply']);
     Lookups::create(['key' => 'type_of_work', 'key_id' => 4, 'value' => 'Fabrication & Repair']);
     Lookups::create(['key' => 'type_of_work', 'key_id' => 5, 'value' => 'Supply & Repair']);
     Lookups::create(['key' => 'type_of_work', 'key_id' => 6, 'value' => 'Fabrication, Repair, & Supply']);
     // Contact number types - Contact numbers
     Lookups::create(['key' => 'quotation_status', 'key_id' => 1, 'value' => 'New']);
     Lookups::create(['key' => 'quotation_status', 'key_id' => 2, 'value' => 'Bill Of Materials']);
     Lookups::create(['key' => 'quotation_status', 'key_id' => 3, 'value' => 'Pending Approval']);
     Lookups::create(['key' => 'quotation_status', 'key_id' => 4, 'value' => 'Approved']);
     // Warranty duration - Contact numbers
     Lookups::create(['key' => 'warranty_duration', 'key_id' => 1, 'value' => 'Days']);
     Lookups::create(['key' => 'warranty_duration', 'key_id' => 2, 'value' => 'Months']);
     Lookups::create(['key' => 'warranty_duration', 'key_id' => 3, 'value' => 'Years']);
     // Discount types - Discounts
     Lookups::create(['key' => 'discount_type', 'key_id' => 1, 'value' => 'Percent']);
     Lookups::create(['key' => 'discount_type', 'key_id' => 2, 'value' => 'Pesos']);
     // Discount modifications - Discounts
     Lookups::create(['key' => 'discount_modification', 'key_id' => 1, 'value' => 'Lot Price']);
     Lookups::create(['key' => 'discount_modification', 'key_id' => 2, 'value' => 'Per Piece']);
 }
示例#7
0
<?php

include_once "Lookups.php";
$lus = new Lookups();
$retval = $lus->GetAllLUItems();
// success?
if ($retval == 0) {
    $arr = $lus->getLookupList();
    foreach ($arr as $item) {
        $luname = $item[0];
        $obj = $item[1];
        if ($luname == "InventoryStatusLU") {
            echo "Name:" . $luname . ", ID:" . $obj->ID . "\n";
        }
    }
}
echo "\n Now by name \n";
$itemName = "InventoryStatusLU";
$retval = $lus->getLookupByName($itemName);
// success?
if ($retval == 0) {
    $arr = $lus->getLookupList();
    foreach ($arr as $item) {
        echo "Name:" . $item->Name . ", ID:" . $item->ID . "\n";
    }
}
echo "\n Now by name by ID \n";
$retval = $lus->getItemNameByID(1);
echo "ID: 1, name:" . $retval . "\n";
echo "\n Get the user names\n";
include_once "UserLU.php";
示例#8
0
 public function getIntresstNames($intrestId)
 {
     $modelIntresst = Lookups::model()->findAll(array('condition' => 'pv_lookup_id ="' . $intrestId . '" AND lookup_type="interests"'));
     if (isset($modelIntresst)) {
         if (count($modelIntresst) > 0) {
             foreach ($modelIntresst as $modInt) {
                 return $modInt['lookup_name'];
             }
         } else {
             return $intrestId;
         }
     }
 }
示例#9
0
 public function actionDeletefj()
 {
     $userid = Yii::app()->session['login']['id'];
     $groupid = $_POST['groupid'];
     // groups tabel deleting
     $groups = Group::model()->findByAttributes(array('group_id' => $groupid));
     //$groups = new Group;
     $groups->group_activestatus = '2';
     if ($groups->save(false)) {
         echo "success";
     }
     $imagetypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadtype', 'lookup_status' => 1, 'lookup_name' => 'Image'));
     $videotypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadtype', 'lookup_status' => 1, 'lookup_name' => 'Video'));
     $sourcetypeidfinao = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadsourcetype', 'lookup_status' => 1, 'lookup_name' => 'finao'));
     $sourcetypeidtile = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadsourcetype', 'lookup_status' => 1, 'lookup_name' => 'tile'));
     $tracked_tileids = Yii::app()->session['login']['id'];
     /*$tileinfo = Tracking::model()->findAllByAttributes(array('tracked_userid'=>$tracked_tileids,'tracked_tileid'=>$tileid));	
     	
     				if(isset($tileinfo['0']['tracking_id']))	
     				{
     	
     					$tileinfo = Tracking::model()->findByAttributes(array('tracking_id'=>$tileinfo['0']['tracking_id']));
     	
     					$tileinfo->delete();	
     	
     				}	*/
     $sourcetypeidjournal = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadsourcetype', 'lookup_status' => 1, 'lookup_name' => 'journal'));
     $groupfinao = UserFinao::model()->findByAttributes(array('group_id' => $groupid));
     // finaos deleteing
     $type = "finao";
     if ($type == "finao") {
         // uploadedetails deleteing
         $delfiles = Uploaddetails::model()->findAllByAttributes(array('upload_sourceid' => $groupfinao->user_finao_id));
         //$delfiles1 = Uploaddetails::model()->findAllByAttributes(array('uploadtype'=>$videotypeid->lookup_id,'upload_sourcetype'=>$sourcetypeidfinao->lookup_id,'upload_sourceid'=>$journalid,'uploadedby'=>$userid));
         if (isset($delfiles) && !empty($delfiles)) {
             foreach ($delfiles as $image) {
                 $image->status = 2;
                 $image->save(false);
             }
         }
         /*if(isset($delfiles1) && !empty($delfiles1))
         				{
         				foreach($delfiles1 as $video)	
         					{
         						$video->status = 2;	
         						$video->save(false);
         	
         					}	
         				}*/
         $tiles = UserFinaoTile::model()->findAllByAttributes(array('finao_id' => $groupfinao->user_finao_id, 'createdby' => $userid));
         if (isset($tiles) && !empty($tiles)) {
             foreach ($tiles as $eachtile) {
                 $eachtile->status = '2';
                 $eachtile->save(false);
             }
         }
         // finaos deleteing
         $finaodel = UserFinao::model()->findAllByAttributes(array('user_finao_id' => $groupfinao->user_finao_id, 'updatedby' => $userid));
         //echo $groupfinao->user_finao_id; echo $userid;
         if (isset($finaodel) && !empty($finaodel)) {
             $finaodel->finao_activestatus = '2';
             $finaodel->save(false);
         }
         $tracked_tileids = Yii::app()->session['login']['id'];
         $tileinfo = Tracking::model()->findAllByAttributes(array('tracked_userid' => $tracked_tileids, 'tracked_tileid' => $tileid));
         if (isset($tileinfo['0']['tracking_id'])) {
             $tileinfo = Tracking::model()->findByAttributes(array('tracking_id' => $tileinfo['0']['tracking_id']));
             $tileinfo->delete();
         }
         //echo "successful";
     }
 }
示例#10
0
文件: Pulldown.php 项目: zekuny/RTPUI
/**
 * Gets the name of a LU item by the ID
 *
 * @param string $luTbl
 * @param int $ID
 */
function displayLUItemNameByID($luTbl, $ID)
{
    // include the lookup object
    include_once "Lookups.php";
    // the name to return
    $name = "";
    // get a lookup object
    $lus = new Lookups();
    // get the items for the pull down
    $retval = $lus->getLookupByName($luTbl);
    // success? get the name
    if ($retval == 0) {
        $name = $lus->getItemNameByID($ID);
    }
    // return to the caller
    return $name;
}
示例#11
0
			   <div id = "showcompletedfinaodiv-default" style="display:none">

			   

			   </div>

		<!------------------ SEARCH DIV FOR TRACKING AND TRACKERS END ---------------- -->

		<!------------------ JOURNAL DIV FOR TRACKING AND TRACKERS START ---------------- -->

				

				<div class="tracking" id="followtracking" style="display:none;">

				<?php 
$findalltiles = Lookups::model()->findAllByAttributes(array('lookup_type' => 'tiles'));
?>

<?php 
//$userid = Yii::app()->session['login']['id'];
?>

					



				

				<div class="padding-10pixels">

				
示例#12
0
 public function actionGetConnectionDetails()
 {
     $userid = $_REQUEST["id"];
     $userAlpha = array();
     //$userBeta = array();
     $userdetails = User::model()->findAll(array("condition" => "userid = " . $userid));
     $usertiles = UserTile::model()->findAll(array('condition' => 'userid = "' . $userid . '" AND status = 1'));
     /*$displaytiles = array();
       
       
       
       foreach($usertiles as $tilename)
       
       
       
       {
       
       
       
       $displaytiles[$tilename->tile_name] = $tilename->tile_name;
       
       
       
       
       
       
       
       } */
     foreach ($userdetails as $usr) {
         $userAlpha["userid"] = $usr->userid;
         $userAlpha["email"] = $usr->email;
         $userAlpha["profile_image"] = $usr->profile_image;
         $userAlpha["lname"] = $usr->lname;
         $userAlpha["location"] = $usr->location;
         $userAlpha["fname"] = $usr->fname;
         $userAlpha["description"] = $usr->description;
         //$userAlpha["socialnetworkid"] = $usr->socialnetworkid;
     }
     /*foreach($userdetails as $tile)
       
       
       
       {
       
       
       
       
       
       
       
       $userBeta["tile_name"] = $usr->tile_name;
       
       
       
       
       
       
       
       }*/
     $alltags = Lookups::model()->findAll(array('condition' => "lookup_type = 'tag' and lookup_status=1"));
     $this->renderPartial('_networkDetail', array('firstConnection' => $userAlpha, 'displaytiles' => $usertiles));
 }
示例#13
0
 public function actionBrowseVideoImage()
 {
     $uploadtype = isset($_REQUEST['imgvid']) ? $_REQUEST['imgvid'] : "";
     if ($uploadtype != "") {
         $page = isset($_REQUEST['pageid']) ? $_REQUEST['pageid'] : 1;
         $targetdiv = $_REQUEST['targetdiv'];
         $limit = 1;
         $uptypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadtype', 'lookup_name' => $uploadtype));
         $criteria = new CDbCriteria();
         $criteria->condition = " explore_finao = 1 and uploadtype = " . $uptypeid->lookup_id;
         $criteria->order = "updateddate desc";
         $uploadImages = Uploaddetails::model()->findAll($criteria);
         $upPageNav = FinaoController::getpagedetails($uploadImages, 1, $page, 1);
         //$criteria->limit = $upPageNav["limittxt"];
         //$lim = FinaoController::getpagecount(count($uploadImages),$limit,$page);
         //print_r($upPageNav);exit;
         $criteria->limit = $upPageNav['limittxt'];
         $criteria->offset = $upPageNav['offset'];
         $uploadImages = Uploaddetails::model()->findAll($criteria);
         $videoembedurl = "";
         $caption = "";
         $userimg = "";
         if (isset($uploadImages) && $uploadImages != "" && count($uploadImages) >= 1) {
             foreach ($uploadImages as $vidup) {
                 if ($uploadtype == 'Video') {
                     if ($vidup->videoid != "" && $vidup->videostatus == 'ready') {
                         $videoembedurl = FinaoController::getviddlembedCode($vidup->videoid);
                     } elseif ($vidup->video_embedurl != "") {
                         $videoembedurl = $vidup->video_embedurl;
                     }
                 } elseif ($uploadtype == 'Image') {
                     $filename = $vidup->uploadfile_path . "/" . $vidup->uploadfile_name;
                     if (file_exists(Yii::app()->basePath . "/../" . $filename)) {
                         $videoembedurl = Yii::app()->baseUrl . $filename;
                     }
                 }
                 $caption = $vidup->caption;
                 $userimg = User::model()->findByPk($vidup->uploadedby);
             }
         }
         $this->renderPartial('_browserImagVideo', array('videoembedurl' => $videoembedurl, 'uploadtype' => $uploadtype, 'upPageNav' => $upPageNav, 'caption' => $caption, 'targetdiv' => $targetdiv, 'userinfo' => $userimg));
     }
 }
示例#14
0
 public function run()
 {
     $user = UserProfile::model()->findByAttributes(array('user_id' => $this->userid));
     $ontrackid = Lookups::model()->findByAttributes(array('lookup_type' => 'finaostatus', 'lookup_name' => 'On Track'));
     $aheadid = Lookups::model()->findByAttributes(array('lookup_type' => 'finaostatus', 'lookup_name' => 'Ahead'));
     $behindid = Lookups::model()->findByAttributes(array('lookup_type' => 'finaostatus', 'lookup_name' => 'Behind'));
     if (isset($this->tileid)) {
         $finaos = UserFinaoTile::model()->findAllByAttributes(array('tile_id' => $this->tileid, 'userid' => $this->userid));
         foreach ($finaos as $finaoids) {
             $ids[] = $finaoids->finao_id;
         }
     }
     if (isset($this->groupid) && $this->groupid != "") {
         $condition = "and IsGroup = 1 and group_id = " . $this->groupid . "";
     } else {
         $condition = "and IsGroup = 0 ";
     }
     $Criteria = new CDbCriteria();
     $Criteria->condition = "userid = '" . $this->userid . "' and finao_activestatus = 1 and IsCompleted = 0 " . $condition . "";
     if (isset($ids) && !empty($ids)) {
         $Criteria->addInCondition('user_finao_id', $ids);
     }
     if (Yii::app()->session['login']['id'] != $this->userid || $this->share == "share") {
         $Criteria->addCondition("finao_status_Ispublic = 1", 'AND');
     }
     $Criteria->order = "updateddate DESC";
     $Criteria->addCondition("finao_status = '" . $ontrackid->lookup_id . "'", 'AND');
     $ontrack = UserFinao::model()->findAll($Criteria);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "userid = '" . $this->userid . "' and finao_activestatus != 2 and IsCompleted = 0";
     if (isset($ids) && !empty($ids)) {
         $Criteria->addInCondition('user_finao_id', $ids);
     }
     if (Yii::app()->session['login']['id'] != $this->userid || $this->share == "share") {
         $Criteria->addCondition("finao_status_Ispublic = 1", 'AND');
     }
     $Criteria->order = "updateddate DESC";
     $Criteria->addCondition("finao_status = '" . $aheadid->lookup_id . "'", 'AND');
     $ahead = UserFinao::model()->findAll($Criteria);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "userid = '" . $this->userid . "' and finao_activestatus != 2 and IsCompleted = 0";
     if (isset($ids) && !empty($ids)) {
         $Criteria->addInCondition('user_finao_id', $ids);
     }
     if (Yii::app()->session['login']['id'] != $this->userid || $this->share == "share") {
         $Criteria->addCondition("finao_status_Ispublic = 1", 'AND');
     }
     $Criteria->order = "updateddate DESC";
     $Criteria->addCondition("finao_status = '" . $behindid->lookup_id . "'", 'AND');
     $behind = UserFinao::model()->findAll($Criteria);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "userid = '" . $this->userid . "' and finao_activestatus != 2 and IsCompleted = 1";
     if (isset($ids) && !empty($ids)) {
         $Criteria->addInCondition('user_finao_id', $ids);
     }
     $Criteria->order = "updateddate DESC";
     $completed = UserFinao::model()->findAll($Criteria);
     /*$ontrack = UserFinao::model()->findAll(array('condition'=>'userid = "'.$this->userid.'" AND finao_status = 38'));
     
     		$ahead = UserFinao::model()->findAll(array('condition'=>'userid = "'.$this->userid.'" AND finao_status = 39'));
     
     		$behind = UserFinao::model()->findAll(array('condition'=>'userid = "'.$this->userid.'" AND finao_status = 40'));*/
     if (isset($this->frndprofile)) {
         $frndprofile = "mainpage";
     } else {
         $frndprofile = "no";
     }
     if (isset($this->left)) {
         $leftlayout = "leftlayout";
     } else {
         $leftlayout = "";
     }
     if (isset($this->finao)) {
         $finaopage = "finao";
     } else {
         $finaopage = "";
     }
     $this->render('_progressBar', array('user' => $user, 'ontrack' => $ontrack, 'ahead' => $ahead, 'behind' => $behind, 'frndprofile' => $frndprofile, 'leftlayout' => $leftlayout, 'finaopage' => $finaopage, 'completed' => $completed));
 }
示例#15
0
/**
 * Gets all the email addresses for everyone in the system.
 *
 */
function getAllEmailAddrs()
{
    include_once "phpAD.inc.php";
    // parse the config file
    $config = parse_ini_file("Config.ini", 1);
    // create and connect to the AD
    $ad = new phpAD($config['Security']['ADServer'], $config['Security']['ADPort']);
    // validate the user
    $retVal = $ad->bind($config['Security']['ADServiceName'] . $config['Security']['DomainSuffix'], $config['Security']['ADServicePassword']);
    // if the user authenticated
    if ($retVal) {
        // include the lookup object
        include_once "Lookups.php";
        // get a lookup object
        $lus = new Lookups();
        // get the items for the pull down
        $lus->getLookupByName("RoleLU");
        // get the list
        $items = $lus->getLookupList();
        // init the return value
        $addrs = "";
        // for each AD group
        foreach ($items as $item) {
            // get the items for the role
            $name = "RENCI_" . $lus->getItemNameByID($item->getID());
            // get the members of the group
            $groupMembers = $ad->getGroupMembers($name);
            // did we get any group members
            if (!empty($groupMembers)) {
                // for each member retrieved
                foreach ($groupMembers as $groupMember) {
                    // get the email address
                    if (isset($groupMember['mail'][0])) {
                        $email = $groupMember['mail'][0];
                    } else {
                        $email = null;
                    }
                    // did we get an email address back
                    if (!empty($email)) {
                        // force mine to be something else
                        if ($email == "*****@*****.**") {
                            $email = "*****@*****.**";
                        }
                        // if we dont have this string already, save the email address
                        if (strpos($addrs, $email) === false) {
                            $addrs = $addrs . $email . ",";
                        }
                    }
                }
            }
        }
    }
    $addrs = substr($addrs, 0, strlen($addrs) - 1);
    // return to the caller
    return $addrs;
}
示例#16
0
 public function actionLearnmore()
 {
     $this->layout = '/layouts/column4';
     $sql = "select t.userid,t.fname,t.lname, t1.user_location,t1.profile_image, t2.*\n\t\tfrom fn_users t \n\t\tjoin fn_user_profile t1 on t.userid = t1.user_id\n                join (select t.*,t2.tilename,t3.lookup_name,t4.video_embedurl,t4.videoid,t4.video_img,t4.video_caption,t4.uploaddetail_id \n                              from fn_user_finao  t \n                              join fn_user_finao_tile t1 on t.user_finao_id = t1.finao_id and t.userid = t1.userid\n\t\t\t      join fn_tilesinfo t2 on t1.tile_id = t2.tile_id and t1.userid = t2.createdby\t\n                              join fn_lookups t3 on t.finao_status = t3.lookup_id \n                              join fn_uploaddetails t4 on  t1.finao_id = t4.upload_sourceid\n                              where t2.tile_id=66\n                              and t.finao_activestatus = 1\n                              and t.finao_status_Ispublic = 1\n                              and t4.video_img !=''\n\t\t\t\t\t\t\t  and t4.videostatus='ready'\n                             group by t.userid,t1.tile_id)  \n\t\tt2 on t.userid = t2.userid\n\t\tgroup by  t.fname,t.lname order by uploaddetail_id desc limit 0,4";
     $connection = Yii::app()->db;
     $command = $connection->createCommand($sql);
     $userdet = $command->queryAll();
     $finaoids = "";
     for ($i = 0; $i < count($userdet); $i++) {
         $finaoids .= $userdet[$i]["user_finao_id"] . ",";
     }
     if ($finaoids != "") {
         $finaoids = substr($finaoids, 0, strlen($finaoids) - 1);
         $sourcetypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadsourcetype', 'lookup_status' => 1, 'lookup_name' => 'finao'));
         $uploaddetails = $this->getlatestuploaddetails($finaoids, $sourcetypeid->lookup_id);
     }
     // winners
     $sql = "select t.userid,t.fname,t.lname, t2.*\n\t\tfrom fn_users t \n\t\tjoin fn_user_profile t1 on t.userid = t1.user_id\n                join (select t.*,t2.tilename,t3.lookup_name,t4.video_embedurl,t4.videoid,t4.video_img,t4.video_caption,t4.uploaddetail_id \n                              from fn_user_finao  t \n                              join fn_user_finao_tile t1 on t.user_finao_id = t1.finao_id and t.userid = t1.userid\n\t\t\t      join fn_tilesinfo t2 on t1.tile_id = t2.tile_id and t1.userid = t2.createdby\t\n                              join fn_lookups t3 on t.finao_status = t3.lookup_id \n                              join fn_uploaddetails t4 on  t1.finao_id = t4.upload_sourceid\n                              where t2.tile_id=66\n                              and t.finao_activestatus = 1\n                              and t.finao_status_Ispublic = 1\n                              and t4.video_img !=''\n\t\t\t\t\t\t\t  and t4.winner=1\n                            group by t.userid,t1.tile_id\n                              order by t.updateddate desc)  \n\t\t\t\t\t\t\t\tt2 on t.userid = t2.userid\n\t\t\t\t\t\t\t\tgroup by  t.fname,t.lname\n\t\t\t\t\t\t\t\torder by t.fname,t.lname";
     $command = $connection->createCommand($sql);
     $winner = $command->queryAll();
     $this->render('_learnmore', array('userdets' => $userdet, 'winner' => $winner, 'uploaddetails' => $uploaddetails, 'tilename' => $tilename, 'totalcnt' => count($userdet)));
 }
 public function actionaddNewFinao()
 {
     $userid = Yii::app()->session['login']['id'];
     $user = User::model()->findByPk($userid);
     $userinfo = UserProfile::model()->findByAttributes(array('user_id' => $userid));
     $Criteria = new CDbCriteria();
     $Criteria->condition = "userid = '" . $userid . "' AND Iscompleted = 0 AND finao_activestatus = 1";
     if (isset($_REQUEST['frndid'])) {
         $Criteria->addCondition("finao_status_Ispublic = 1", 'AND');
     }
     $Criteria->order = "updateddate DESC";
     $finaos = UserFinao::model()->findAll($Criteria);
     if (!empty($finaos)) {
         $Criteria = new CDbCriteria();
         $Criteria->group = 'tile_id';
         $Criteria->condition = "userid = '" . $userid . "'";
         if (!empty($finaos)) {
             foreach ($finaos as $finaoids) {
                 $ids[] = $finaoids->user_finao_id;
             }
         }
         if (!empty($ids)) {
             $Criteria->addInCondition('finao_id', $ids);
         }
         $Criteria->order = 'updateddate DESC';
         $tilesinfo = UserFinaoTile::model()->findAll($Criteria);
     } else {
         $tilesinfo = "";
     }
     $tileslist = $tilesinfo;
     $totaltilecount = count($tilesinfo);
     $tiles = Lookups::model()->findAll(array('condition' => 'lookup_type = "tiles" AND lookup_status = 1 '));
     $this->renderPartial('_newfinaolayout', array('model' => $model, 'userid' => $userid, 'tiles' => $tilesinfo, 'newtile' => $newtile, 'upload' => $upload, 'type' => $type, 'userinfo' => $userinfo));
     //$this->renderPartial('_newfinaolayout',array('newfinao'=>'new'));
 }
示例#18
0
文件: ADTest.php 项目: zekuny/RTPUI
 // include the user LU object
 include_once "UserLU.php";
 // create a new object
 $userlu = new UserLU();
 // load the names
 $userlu->getAllUserNames();
 // get the user ID
 $ID = $userlu->getItemIDByName($username);
 // did we get a valid ID
 if (!empty($ID)) {
     $this->ID = $ID;
 }
 // save the email address
 $this->setEmailAddress($userInfo['mail'][0]);
 // get a lookup object
 $lus = new Lookups();
 // get the items for the pull down
 $lus->getLookupByName("RoleLU");
 // loop though the roles for this user
 foreach ($userInfo['memberof'] as $item) {
     // look for the NCGENES identifier
     $pos = strpos($item, "RENCI_NCGENES ");
     // did we find it
     if ($pos > 0) {
         // find the next comma
         $comma = strpos($item, ",");
         // get the role name
         $roleName = substr($item, $pos, $comma - $pos);
         // get the ID of the role
         $ID = $lus->getItemIDByName($roleName);
         // did we get a valid ID
示例#19
0
 public function init()
 {
     $this->interest = Lookups::model()->findAllByAttributes(array('lookup_parentid' => 0, 'lookup_type' => 'interests'));
 }
示例#20
0
 /**
  * Get values from lookups table
  *
  * @return array
  * @author Gat
  **/
 protected function lookupSelect($key)
 {
     return Lookups::key($key)->lists('value', 'key_id');
 }
示例#21
0
文件: User.php 项目: zekuny/RTPUI
 /**
  * Authenticates the user and retrieves a bunch of data about him/her from AD
  * Returns whether the user was authenticated (boolean)
  *
  * @param unknown_type $username
  * @param unknown_type $password
  */
 function authenticateUser($username, $password)
 {
     // init the return value
     $retVal = false;
     // include the AD utils
     include_once "phpAD.inc.php";
     // include the app;lication constants
     include_once "Constants.php";
     // parse the config file
     $config = parse_ini_file("Config.ini", 1);
     // create and connect to the AD
     $ad = new phpAD($config['Security']['ADServer'], $config['Security']['ADPort']);
     // validate the user
     $retVal = $ad->bind($username . $config['Security']['DomainSuffix'], $password);
     // get the name of the product
     $product = $config['Product']['Name'];
     // if the user authenticated
     if ($retVal) {
         // get the user info
         $userInfo = $ad->getUser($username);
         // set the user info
         $this->setUserName($username);
         $this->setFirstName($userInfo['givenname'][0]);
         $this->setLastName($userInfo['sn'][0]);
         // if we got a telephone number from AD, set it
         if (isset($userInfo['telephonenumber'][0])) {
             $this->setPhoneNumber($userInfo['telephonenumber'][0]);
         }
         // if we got a department number from AD, set it
         if (isset($userInfo['department'][0])) {
             $this->setDepartment($userInfo['department'][0]);
         }
         // if we got a email address from AD, set it
         if (isset($userInfo['mail'][0])) {
             $this->setEmailAddress($userInfo['mail'][0]);
         }
         // reset role list
         $this->Role = array();
         // include the lookup object
         include_once "Lookups.php";
         // include the user LU object
         include_once "UserLU.php";
         // create a new object
         $userlu = new UserLU();
         // load the names
         $userlu->getAllUserNames();
         // get the user ID
         $ID = $userlu->getItemIDByName($username);
         // did we get a valid ID
         if (!empty($ID)) {
             $this->ID = $ID;
         }
         // get a lookup object
         $roleLUs = new Lookups();
         // get the items for the pull down
         $roleLUs->getLookupByName("RoleLU");
         //error_log(print_r($roleLUs, true));
         // check if the user is a memeber of a role
         if (isset($userInfo['memberof'])) {
             // loop though the roles for this user
             foreach ($userInfo['memberof'] as $item) {
                 // look for the product identifier in the role name
                 $pos = strpos($item, $product . " ");
                 // did we find it
                 if ($pos > 0) {
                     // find the position of the end of the product name
                     $productEnd = $pos + strlen($product);
                     // find the position of the next comma (AD returns a comma separated list of items, we only care about the first one)
                     $comma = strpos($item, ",");
                     // get the role name
                     $roleName = substr($item, $pos, $comma - $pos);
                     // init the role ID
                     $roleID = null;
                     // get the ID of the role by looking up the role name in the database
                     $roleID = $roleLUs->getItemIDByName($roleName);
                     //error_log(print_r($roleID, true));
                     // did we get a valid role ID
                     if (!empty($roleID) && isset($roleID)) {
                         // save the role ID
                         $this->Role[] = $roleID;
                         // if this guy is an administrator
                         if (strpos($roleName, "Administrator")) {
                             $this->setAdminUser(true);
                         }
                     }
                 }
             }
         }
         //error_log(print_r($userInfo, true));
     } else {
         error_log("Error: Could not bind to the UNC AD for user: " . $username, 0);
     }
     // if there are no roles assigned to the user deny access
     if (!isset($this->Role) || !isset($this->ID) || empty($this->Role)) {
         $retVal = false;
     }
     // return to the caller
     return $retVal;
 }
示例#22
0
 public function actionTracktiles()
 {
     $findalltiles = Lookups::model()->findAllByAttributes(array('lookup_type' => 'tiles'));
     $this->renderPartial('tracktiles', array('findalltiles' => $findalltiles));
 }