Example #1
0
 public function run()
 {
     $this->registerCss();
     if (!$this->user) {
         $this->user = Yii::app()->user->profile;
     }
     $this->imageSrc = $this->user->getPhoto($this->imgWidth, $this->imgHeight);
     $this->imageAlt = $this->user->username;
     $this->width = $this->containerWidth;
     $this->height = $this->containerHeight;
     $this->htmlOptions = array('class' => 'users-photo users-photo-' . $this->user->user_id);
     parent::run();
 }
Example #2
0
 /**
  * Edit a user -- deprecated; must edit directly through database
  *
  * Route: /users/edit/{id}
  */
 public function edit($id)
 {
     if (!$this->authorized() && (strstr($this->session->userdata('role'), 'staff') || ($id = $this->session->userdata('id')))) {
         header('Location: /auth/login');
     }
     $user = new User($id);
     $data['user'] = $user;
     $data['profile_pic'] = $user->getPhoto();
     $this->template->title = $user->first_name . ' ' . $user->last_name;
     $this->template->javascript->add('assets/js/vendor/jquery.ui.widget.js');
     $this->template->javascript->add('assets/js/jquery.iframe-transport.js');
     $this->template->javascript->add('assets/js/jquery.fileupload.js');
     $this->template->content->view('users/view', $data);
     $this->template->publish();
 }
Example #3
0
             $user = new User($_POST['editPhoto']);
             $user->editPhoto($_POST['i'], $_POST['j'], $_POST['description'], $_POST['photoDate']);
             $statement = true;
         } else {
             if (isset($_POST['addPhoto'])) {
                 $user = new User($_POST['addPhoto']);
                 $statement = $user->addPhoto($_POST['i'], $_POST['photoName'], $_POST['description'], $_POST['photoSize'], $_POST['photoDate'], $_POST['sourcePath']);
             } else {
                 if (isset($_POST['deletePhoto'])) {
                     $user = new User($_POST['deletePhoto']);
                     if (is_array($_POST['j'])) {
                         //allow to delete multiple photo at a times by pass array of integers
                         rsort($_POST['j']);
                         //to make sure that deletion will start for behind
                         for ($i = 0; $i < count($_POST['j']); $i++) {
                             $photoInfo = $user->getPhoto($_POST['i'], $_POST['j'][$i]);
                             unlink($photoInfo['sourcePath']);
                             $user->deletePhoto($_POST['i'], $_POST['j'][$i]);
                         }
                         $statement = true;
                     } else {
                         $photoInfo = $user->getPhoto($_POST['i'], $_POST['j']);
                         unlink($photoInfo['sourcePath']);
                         $user->deletePhoto($_POST['i'], $_POST['j']);
                         $statement = true;
                     }
                 }
             }
         }
     }
 }
Example #4
0
								<li>
									<a href='/home/hfd' >Housing/Maintenance</a>
								</li>
								<li>
									<a href='/home/policies' >Dorm Policies</a>
								</li>
							</ul>
						</li><!--Help-->
					</ul><!--nav-->

					<div class="login">
						<?php 
if ($this->session->userdata('id')) {
    ?>
						<img src="<?php 
    echo $user->getPhoto();
    ?>
" class="profile-img img-circle" />
						<span><?php 
    echo $user->getName();
    ?>
</span>
						<a href="/auth/logout">Logout</a>
						<?php 
} else {
    ?>
						<img src="/assets/images/shield.png" class="profile-img img-circle" />
						<span>Welcome, Guest!</span>
						<a href="/auth/login">Login</a>
						<?php 
}
Example #5
0
function showComments4OneGalary($module, $visitor, $userID, $listNum, $altname)
{
    $gal = new Galary();
    $comm = new Commentor();
    $commArr = $comm->readAllComments($userID);
    if (count($commArr) == 0) {
        $r["text"] = "Отсутствуют комментарии!";
        return $r;
    }
    $galIdsArr = $gal->getGalaryIDs($altname);
    if (count($galIdsArr) == 0) {
        $r["text"] = "Отсутствуют изображения!";
        return $r;
    }
    foreach ($commArr as $index => $value) {
        //$tempArr[] = $commArr[$index][$value["id"]];
        //$tempArr[] =
        foreach ($galIdsArr as $index2 => $value2) {
            if ($value["pid"] == $value2["id"]) {
                $tempArr[] = $value;
            }
        }
    }
    $sortedArr = listing($tempArr, $listNum, 10);
    //20 - здесь указывается количество элементов на листе
    foreach ($sortedArr as $index => $value) {
        if ($index !== "listCount" && $index !== "listCurrent") {
            $user = new User($value["poster_user"]);
            $photo = $user->getPhoto();
            $userName = $user->name . "&nbsp;" . $user->secondName;
            $commDate = $value["comment_time"];
            $comment = $value["comment"];
            $imgProp = $gal->getImgProperties($value["pid"]);
            $link = "/" . "galary" . "/" . $imgProp["altname"] . "/" . $imgProp["id"] . "/";
            if ($visitor == $userID || $visitor == $value["poster_user"]) {
                $delUser = $value["poster_user"];
                $commID = $value["id"];
                $delLink = "<a href=\"{$link}?comm={$commID}\">Удалить</a>";
            } else {
                $delLink = "";
            }
            $previewPath = $gal->getPreviewPathById($value["pid"]);
            $imgCommented = "<a href=\"{$link}\"> <img src=\"{$previewPath}\" style=\"max-width:90px; max-height: 90px;\"> </a>";
            $strTable = $strTable . "<table border=\"1\">\n<tr>\n<td>\n  \r\n\t\t\t\t<img src=\"{$photo}\" style=\"max-width:90px; max-height: 90px;\" > \r\n\t\t\t\t\n</td>\n\r\n\t\t\t\t<td> {$userName}  &nbsp;&nbsp;&nbsp; {$commDate} &nbsp;&nbsp;&nbsp;   {$delLink} <br /> {$comment} </td>\r\n\t\t\t\t<td> {$imgCommented} </td></tr>\n</table>\n";
        }
    }
    $numerator = makeNumerator($sortedArr["listCount"], $sortedArr["listCurrent"], "g");
    $res["text"] = $numerator . $strTable . $numerator;
    return $res;
}