Example #1
0
$db = new database();
$sql = "select * from user_stage us,\r\n\t\tstages s\r\n\t\twhere us.userID = {$userID}\r\n\t\tand\ts.stageID = us.stageID ";
// print $sql;
if (!($result = $db->query($sql))) {
    die('Error:' . $db->error());
}
$user_stage = array();
while ($row = $db->fetcharray()) {
    $user_stage[] = $row;
}
$db->freeresult();
$msg = new messages();
$messages = $msg->view_unread_messages($userID);
$total_unread_messages = count($messages) - 1;
$fb = new feedbacks();
$feedbacks = $fb->view_unread_feedbacks(1);
$total_unread_feedbacks = count($feedbacks) - 1;
$feedbacks = $fb->view_unread_feedbacks(2);
$total_unread_sources = count($feedbacks) - 1;
// get all articles belong in da specific category and edit by this editor assigned on dat category
if ($editor_on_category) {
    $sql = "select * from article_versions av, article_category ac where \r\n\t\t\t((av.stageID = 2 and av.status != 'revise') or (av.stageID = 3 and av.status = 'revise' )) \r\n\t\t\tand (( av.isarchive = '0' and ( ac.articleID = av.articleID ) and ( ac.categoryID = '{$assigned_category}' ))) order by av.created DESC \r\n\t";
} else {
    // wil display all articles regardless of category so that this user can edit them..
    $sql = "select * from article_versions av where \r\n\t\t\t(av.stageID = 2 and av.status != 'revise') or (av.stageID = 3 and av.status = 'revise' ) \r\n\t\t\tand av.isarchive = '0' order by av.created DESC \r\n\t";
}
if (!($result = $db->query($sql))) {
    die('Error:' . $db->error());
}
$writing = array();
while ($row = $db->fetcharray()) {