Example #1
0
        if (isset($e["name"])) {
            echo $e["name"];
        }
        ?>
							</a>
						</td>
						<td><?php 
        if (isset($e["type"])) {
            echo $e["type"];
        }
        ?>
</td>
						<td class="center">
							<div class="visible-md visible-lg hidden-sm hidden-xs">
								<?php 
        if (isset(Yii::app()->session["userId"]) && Authorisation::isEventAdmin((string) $e["_id"], Yii::app()->session["userId"])) {
            ?>
								<a href="javascript:;" class="disconnectBtn btn btn-xs btn-red tooltips " data-type="<?php 
            echo PHType::TYPE_EVENTS;
            ?>
" data-id="<?php 
            echo (string) $e["_id"];
            ?>
" data-name="<?php 
            echo (string) $e["name"];
            ?>
" data-placement="left" data-original-title="Unlink event" ><i class=" disconnectBtnIcon fa fa-unlink"></i></a>
								<?php 
        }
        ?>
							</div>
 /**
  * Get the authorization for edit an item
  * @param type is the type of item, (organization or event or person or project)
  * @param itemId id of the item we want to edits
  * @return a boolean
  */
 public static function canEditItem($userId, $type, $itemId)
 {
     $res = false;
     if ($type == PHType::TYPE_EVENTS) {
         $res = Authorisation::isEventAdmin($itemId, $userId);
     } else {
         if ($type == PHType::TYPE_PROJECTS) {
             $res = Authorisation::isProjectAdmin($itemId, $userId);
         } else {
             if ($type == Organization::COLLECTION) {
                 $res = Authorisation::isOrganizationAdmin($userId, $itemId);
             } else {
                 if ($type == Person::COLLECTION) {
                     $res = $userId == $itemId;
                 }
             }
         }
     }
     return $res;
 }
Example #3
0
	<div class="panel panel-white">
		<div class="panel-heading border-light">
			<h4 class="panel-title"><i class="fa fa-users fa-2x text-green"></i> Participants</h4>
		</div>
		<div class="panel-tools">
			<?php 
if (Authorisation::isEventAdmin((string) $event['_id'], @Yii::app()->session["userId"])) {
    ?>
				<a href="#newAttendees" class="new-attendees btn btn-xs btn-light-blue tooltips" data-toggle="tooltip" data-placement="top" title="Add attendees" alt="Add attendees"><i class="fa fa-plus"></i> </a>
			<?php 
}
?>
		</div>
		<div class="panel-body no-padding">
			<div class="tabbable no-margin no-padding partition-dark">
				<ul id="myTab" class="nav nav-tabs">
					<li class="active">
						<a href="#users_tab_attending" data-toggle="tab">
							<span><i class="fa fa-child"></i>
							Attending
							</span>
						</a>
					</li>
				</ul>
				<div class="tab-content partition-white">
					<div class="tab-pane padding-bottom-5 active" id="users_tab_attending">
						<div class="panel-scroll height-230 ps-container">
							<table class="table table-striped table-hover">
								<tbody>
									<?php 
Example #4
0
 public static function updateEvent($eventId, $event, $userId)
 {
     if (!Authorisation::isEventAdmin($eventId, $userId)) {
         throw new CTKException("Can not update the event : you are not authorized to update that event!");
     }
     if (isset($event["tags"])) {
         $event["tags"] = Tags::filterAndSaveNewTags($event["tags"]);
     }
     PHDB::update(Event::COLLECTION, array("_id" => new MongoId($eventId)), array('$set' => $event));
     return array("result" => true, "msg" => "Votre evenement a été modifié avec succes", "id" => $eventId);
 }