Esempio n. 1
0
 /**
  * @route announcement/dismiss
  */
 public function dismissAnnouncement()
 {
     $announce_bp = $this->blueprint('Announcements');
     if (IDE_HACKS) {
         $db = \Airship\get_database();
         $announce_bp = new Announcements($db);
     }
     if (empty($_POST['dismiss'])) {
         \Airship\json_response(['status' => 'ERROR', 'message' => 'Insufficient parameters']);
     }
     $result = $announce_bp->dismissForUser($this->getActiveUserId(), $_POST['dismiss']);
     if ($result) {
         \Airship\json_response(['status' => 'OK', 'message' => '']);
     }
     \Airship\json_response(['status' => 'ERROR', 'message' => 'An unknown error has occurred.']);
 }
Esempio n. 2
0
 public function show_announce($id)
 {
     $post_comment = AnnouncementComments::where('post_id', $id)->orderBy('created_at', 'desc')->get();
     $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first();
     $announce = Announcements::with('user')->where('post_id', $id)->orderBy('created_at', 'desc')->first();
     $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first();
     $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get();
     return View::make('dashboard.announcement')->with('post', $announce)->with('post_comment', $post_comment)->with('profile', $profile)->with('countleave', $leavecount)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('title', 'STI | Show Announcement');
 }
Esempio n. 3
0
 /**
  * @route /
  */
 public function index()
 {
     if ($this->isLoggedIn()) {
         $this->storeLensVar('showmenu', true);
         $author_bp = $this->blueprint('Author');
         $announce_bp = $this->blueprint('Announcements');
         $blog_bp = $this->blueprint('Blog');
         $page_bp = $this->blueprint('CustomPages');
         if (IDE_HACKS) {
             $db = \Airship\get_database();
             $author_bp = new Author($db);
             $announce_bp = new Announcements($db);
             $blog_bp = new Blog($db);
             $page_bp = new CustomPages($db);
         }
         $this->lens('index', ['announcements' => $announce_bp->getForUser($this->getActiveUserId()), 'stats' => ['num_authors' => $author_bp->numAuthors(), 'num_comments' => $blog_bp->numComments(true), 'num_pages' => $page_bp->numCustomPages(true), 'num_posts' => $blog_bp->numPosts(true)], 'title' => \__('Dashboard')]);
     } else {
         $this->storeLensVar('showmenu', false);
         $this->lens('login');
     }
 }
Esempio n. 4
0
 /**
  * Remove the specified resource from storage.
  * DELETE /admin/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $delete = Announcements::where('post_id', $id)->delete();
     return Redirect::route('home');
 }
Esempio n. 5
0
   
   <div class="page-title">
        <h1 class="title"><?php 
echo $page_title;
?>
</h1>
        <p class="description"><?php 
if (isset($sub_title)) {
    echo $sub_title;
} else {
    echo 'This page needs subtitle.';
}
?>
</p>
    </div><!--page title ends here.-->
   
<div class="row mywidget">
    <?php 
//announcement box starts here.
if (isset($_POST['active_notification'])) {
    $_SESSION['active_notification'] = $_POST['active_notification'];
}
if (isset($_SESSION['active_notification']) && $_SESSION['active_notification'] == 'No') {
    //when notification is not active.
} else {
    if (isset($_SESSION['user_type'])) {
        $ann_obj = new Announcements();
        $ann_obj->get_latest_announcement();
    }
}
//announcement box ends here.
Esempio n. 6
0
 /**
  * Displays an announcement at the top of the screen
  *
  * @param string $announcement - optional for non-admin pages
  * @return array
  */
 public function checkAnnouncements($announcement = '')
 {
     $announce = Announcements::instance();
     if ($this->adminPage) {
         return $announce->checkAdminAnnouncements($this);
     } else {
         return $announce->checkAnnouncements($this, $announcement);
     }
 }
Esempio n. 7
0
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2048 $
 */
define('CURSCRIPT', 'announce');
require "../libraries/common.inc.php";
require "../share.inc.php";
uses("announcement");
$announce = new Announcements();
$announce_controller = new Announcement();
$viewhelper->setTitle(L("announce", "tpl"));
$types = cache_read("type");
$viewhelper->setPosition(L("announce", "tpl"), "announce/");
if (isset($_GET['title'])) {
    $title = rawurldecode(trim($_GET['title']));
    $res = $announce->findBySubject($title);
    $id = $res['id'];
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
}
if (!empty($id)) {
    $result = $announce->findById($id);
    if (!empty($result)) {
        $result['message'] = nl2br($result['message']);
        $viewhelper->setPosition($types['announcementtype'][$result['announcetype_id']], "announce/?do=search&typeid=" . $result['announcetype_id']);
        $viewhelper->setTitle($result['subject']);
Esempio n. 8
0
/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
require "../libraries/common.inc.php";
uses("announcement");
require "session_cp.inc.php";
require LIB_PATH . "page.class.php";
require LIB_PATH . "cache.class.php";
require LIB_PATH . "time.class.php";
require CACHE_COMMON_PATH . "cache_type.php";
$page = new Pages();
$cache = new Caches();
$announce = new Announcements();
$tpl_file = "announce";
setvar("Types", $_PB_CACHE['announcementtype']);
$conditions = array();
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $announce->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
Esempio n. 9
0
<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2048 $
 */
define('CURSCRIPT', 'announce');
require "../libraries/common.inc.php";
require "../share.inc.php";
uses("announcement");
$conditions = array();
$announce = new Announcements();
$announce_controller = new Announcement();
$viewhelper->setTitle(L("announce", "tpl"));
$types = cache_read("type");
$viewhelper->setPosition(L("announce", "tpl"), "announce/");
if (!empty($_GET['typeid'])) {
    $conditions[] = "announcetype_id=" . intval($_GET['typeid']);
}
$result = $announce->findAll("*", null, $conditions, "display_order ASC,id DESC");
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        if (!empty($result[$i]['created'])) {
            $result[$i]['pubdate'] = date("Y-m-d", $result[$i]['created']);
            $result[$i]['title'] = $result[$i]['subject'];
            $result[$i]['typename'] = $types['announcementtype'][$result[$i]['announcetype_id']];
            $result[$i]['type_id'] = $result[$i]['announcetype_id'];
        }
    }
Esempio n. 10
0
 /**
  * Displays an announcement at the top of the screen
  *
  * @param string $announcement - optional for non-admin pages
  * @return array
  */
 public function checkAnnouncements($announcement = '')
 {
     require_once LIBS . 'Announcements.php';
     $announce = new Announcements();
     if ($this->isAdmin) {
         return $announce->checkAdminAnnouncements($this);
     } else {
         return $announce->checkAnnouncements($this, $announcement);
     }
 }