function show_announcements($template_name)
 {
     $current_user =& singleton("current_user");
     global $TPL;
     $query = "SELECT *\n                FROM announcement \n               WHERE displayFromDate <= CURDATE() AND displayToDate >= CURDATE()\n            ORDER BY displayFromDate desc";
     $db = new db_alloc();
     $db->query($query);
     while ($db->next_record()) {
         $announcement = new announcement();
         $announcement->read_db_record($db);
         $announcement->set_tpl_values();
         $person = $announcement->get_foreign_object("person");
         $TPL["personName"] = $person->get_name();
         include_template($this->get_template_dir() . $template_name);
     }
 }
Esempio n. 2
0
function show_announcements($template_name)
{
    global $TPL;
    $people =& get_cached_table("person");
    $query = "SELECT announcement.* \n              FROM announcement \n              ORDER BY displayFromDate DESC";
    $db = new db_alloc();
    $db->query($query);
    while ($db->next_record()) {
        $announcement = new announcement();
        $announcement->read_db_record($db);
        $announcement->set_values();
        $TPL["personName"] = $people[$announcement->get_value("personID")]["name"];
        $TPL["odd_even"] = $TPL["odd_even"] == "odd" ? "even" : "odd";
        include_template($template_name);
    }
}
Esempio n. 3
0
    function init() {
        $this->archive = new archive();
        $this->category = category::getInstance();
        $this->view->category = $this->category->category;
        if (front::get('page'))
            $page = front::get('page');
        else
            $page = 1;
        $this->view->page = $page;
        front::check_type($page);
        $_catpage = category::categorypages(front::get('catid'));
        if ($_catpage) {
            $this->pagesize = $_catpage;
        } else {
            $this->pagesize = config::get('list_pagesize');
        }
        front::check_type($this->pagesize);
        $announcement = new announcement();
        $this->view->announcements = $announcement->getrows(null, 10);
        $this->view->usergroupid = 1000;
        front::check_type(cookie::get('login_username'), 'safe');
        front::check_type(cookie::get('login_password'), 'safe');
        $this->view->showarchive = archive::getInstance()->getrow(front::get('aid'));
        $addcontentuser = new user();
        $addcontentuser = $addcontentuser->getrow(array('userid' => $this->view->showarchive['userid']));
        if (is_array($addcontentuser)) {
            $this->view->adduser = $addcontentuser;
        }
        if (cookie::get('login_username') && cookie::get('login_password')) {
            $user = new user();
            $user = $user->getrow(array('username' => cookie::get('login_username')));
            if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) {
                $this->view->user = $user;
                $this->view->usergroupid = $user['groupid'];
				$obj = new usergroup();
				$this->roles = $obj->getrow(array('groupid'=>$this->view->usergroupid));
            }
        }
    }
Esempio n. 4
0
function announ($num=10) {
    $announcement=new announcement();
    $announcs=$announcement->getrows(null,$num);
    foreach ($announcs as $order=>$annc) {
        $announcs[$order]['adddate']=sdate($annc['adddate']);
        $announcs[$order]['url']=announcement::url($annc['id']);
    }
    return $announcs;
}
Esempio n. 5
0
 function show_action() {
     front::check_type(front::get('id'));
     $announcement=new announcement();
     $this->view->announ=$announcement->getrow(front::get('id'));
 }
Esempio n. 6
0
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
// initialise the request
require_once "../alloc.php";
// create an object to hold an announcement
$announcement = new announcement();
// load the announcement from the database
$announcementID = $_POST["announcementID"] or $announcementID = $_GET["announcementID"];
if ($announcementID) {
    $announcement->set_id($announcementID);
    $announcement->select();
}
// read announcement variables set by the request
$announcement->read_globals();
// process submission of the form using the save button
if ($_POST["save"]) {
    $announcement->set_value("personID", $current_user->get_id());
    $announcement->save();
    alloc_redirect($TPL["url_alloc_announcementList"]);
    // process submission of the form using the delete button
} else {