Пример #1
0
 $sender = $request['sender'];
 $reponse = !empty($request['accept']) ? 1 : 0;
 try {
     if ($reponse == 1) {
         $sql = array("id_project" => $sender, "id_member" => $pk);
         $member = new ProjectMemberSet();
         $member->fields = array('status' => 2);
         $member->update($sql);
         $project = new Project();
         $project = $project->get(array("id_project" => $sender, "status" => 1));
         $project = $project[0];
         $name = explode(" ", $logado['name']);
         $name = $name[0];
         $title = '<b>' . ucfirst($name) . '</b> aceitou seu convite para <b>' . $project['title'] . '</b>';
         $sql = array('typing' => 2, 'title' => $title, 'id_sender' => $logado['id_member'], 'id_receiver' => $project['id_admin']);
         $notification = new NotificationGranttype($sql);
         $notification->save();
         echo "<script>window.parent.\$('#modal_dialog').removeClass('active-lg')</script>";
         die;
     } else {
         if ($reponse == 0) {
             $sql = array("id_project_member_set" => $pk);
             $member = new ProjectMemberSet();
             $member->fields = array('status' => 0);
             $member->update($sql);
             die;
         }
     }
     throw new Exception('Error');
 } catch (Exception $e) {
     echo "fdsfsdfads";
<?php

require_once 'init.php';
use Agil\View\View;
$request = View::route($_GET);
$pk = $request['pk'];
$sql = array("id_notification_granttype" => $pk);
$model = new NotificationGranttype();
$model->fields = array('status' => 2);
$model->update($sql);
$model->fields = array('id_notification_granttype', 'title', 'body', 'id_sender');
$count = $model->count($sql);
if ($count == 1) {
    $rs = $model->get($sql);
    $rs = $rs[0];
    ?>
		<div class="modal-content">
			<div class="modal-header">
				<button class="close" onclick="boss.removeClass('modal_dialog', 'active')">x</button>
				<h3 class="modal-title font-open-sans"><?php 
    echo $rs['title'];
    ?>
</h3>
			</div>
			<form action="/app/team/contribute/" method="post" target="compiler">
				<div class="modal-body">
					<div class="container">
						<?php 
    if ($rs['body']) {
        ?>
								<p>
<?php

require_once 'init.php';
use Agil\Session\Session;
$logado = Session::get('logado');
$id_member = $logado['id_member'];
$sql = array("id_receiver" => $id_member);
$model = new NotificationGranttype();
$model->fields = array('id_notification_granttype', 'title', 'body', 'typing', 'status');
$rs = $model->get($sql, 'id_notification_granttype DESC');
?>

	<table id="notification_granttype" class="table table-striped" style="margin-bottom: 0px;">
		<?php 
if (count($rs) > 0) {
    foreach ($rs as $index => $notification) {
        ?>
						<tr style="cursor: pointer;" <?php 
        if ($notification['typing'] == 1 && $notification['status'] == 1) {
            ?>
onclick="boss.ajax.load('/app/notification/view_notification_body/?pk=<?php 
            echo $notification['id_notification_granttype'];
            ?>
', '#modal_dialog', 'active-lg');"<?php 
        }
        ?>
>
							<td>
								<div class="col-12">
									<div class="col-1 pull-left">
										<img src="/static/img/icons/user_black.png" width="28px">
<?php

require_once 'init.php';
use Agil\Session\Session;
header('Content-Type: application/json');
$logado = Session::get('logado');
$sql = array("id_receiver" => $logado['id_member'], "status" => 1);
$result = array();
$model = new NotificationGranttype();
$model->fields = array('id_notification_granttype', 'title', 'body', 'id_sender');
$count = $model->count($sql);
$result['count'] = $count;
if (!empty($_COOKIE['comment_loadplace'])) {
    $result['ajax'] = array('url' => $_COOKIE['comment_loadplace'], 'place' => '#comment_loadplace');
}
echo json_encode($result);