예제 #1
0
 public static function exists($username)
 {
     Zend_Registry::get('logger')->debug('Find matching line item');
     $users = new User();
     $where = $users->_db->quoteInto('username = ?', $username);
     $result = $users->fetchAll($where);
     return $result->exists();
 }
예제 #2
0
 function showList()
 {
     //Списък потребители
     $user_model = new User($this->dbconn);
     $users = $user_model->fetchAll(array('filter' => ' ORDER BY id desc  ', 'values' => array()));
     $this->smarty->Assign('users', $users);
     $this->display('User/list.tpl');
 }
function _show_users()
{
    isUserLoggedIn();
    $user = new User(getdbh());
    $user_details = $user->fetchAll();
    $result['user'] = $user_details;
    $data['msg'][] = View::do_fetch(VIEW_PATH . 'afisare_user.tpl.php', $result);
    View::do_dump(VIEW_PATH . 'layout.php', $data);
}
function _addGrupaUsers($id = 0)
{
    isUserLoggedIn();
    $user = new User(getdbh());
    $getUsers = $user->fetchAll();
    $result['user'] = $getUsers;
    $result['grupaID'] = $id;
    $data['msg'][] = View::do_fetch(VIEW_PATH . 'addUserGrupa.tpl.php', $result);
    View::do_dump(VIEW_PATH . 'layout.php', $data);
}
예제 #5
0
 function index($varnish_cashe = NULL)
 {
     //Последно регистрирани
     $user_model = new User($this->dbconn);
     $users = $user_model->fetchAll(array('filter' => ' ORDER BY id desc LIMIT 10 ', 'values' => array()));
     $this->smarty->Assign('users', $users);
     //Последно създадени дървета
     $tree_model = new Tree($this->dbconn);
     $trees = $tree_model->fetchAll(array('filter' => ' ORDER BY id desc LIMIT 10 ', 'values' => array()), 'all');
     $this->smarty->Assign('trees', $trees);
     $this->display('Main/main.tpl');
 }
예제 #6
0
파일: Searcher.php 프로젝트: knatorski/SMS
 protected function buildSQl()
 {
     $select = $this->dbModelTable->select();
     $user = new User();
     if (isset($this->filterdata['deleg_no']) and !empty($this->filterdata['deleg_no'])) {
         $select->where('deleg_no = ?', $this->filterdata['deleg_no']);
     }
     if (isset($this->filterdata['employee']) and !empty($this->filterdata['employee'])) {
         $tetaId = $user->findOne($this->filterdata['employee'])->teta_id;
         $select->where('teta_id = ?', $tetaId);
     } else {
         if (isset($this->filterdata['branch']) and !empty($this->filterdata['branch'])) {
             $userRowset = $user->fetchAll('id_branch = ' . $this->filterdata['branch']);
             $inStmt = array();
             foreach ($userRowset as $row) {
                 $inStmt[] = $row->teta_id;
             }
             $select->where('teta_id IN (?)', $inStmt);
         }
     }
     return $select->__toString();
 }
예제 #7
0
 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     $method = $this->getRequest()->getMethod();
     $view = $this->initView();
     $callback = $this->getRequest()->getParam('callback');
     $id = $this->getRequest()->getParam('id');
     $date = $this->getRequest()->getParam('date');
     if ($method == 'GET') {
         $user = new User();
         if ($id) {
             $s = 'id';
             if (!is_numeric($id)) {
                 $s = 'login';
             }
             $row = $user->fetchRow($user->select()->where($s . ' = ?', $id));
             if (is_null($row)) {
                 /* 404 Not Found */
                 $this->getResponse()->setHttpResponseCode(404);
             } else {
                 $response = Zend_Json_Encoder::encode($row->toArray());
             }
         } else {
             $rows = $user->fetchAll();
             $users = $rows->toArray();
             if ($users == 0) {
                 /* 404 Not Found */
                 $this->getResponse()->setHttpResponseCode(404);
             } else {
                 /*foreach ($users as &$u) {
                 			$u['teste'] = $id.' - '.$date;
                 		}*/
                 $response = Zend_Json_Encoder::encode($users);
             }
         }
         if ($callback) {
             $response = $callback . "(" . $response . ")";
         }
         $view->json = $response;
         $this->render('json');
     } elseif ($method == 'POST') {
         //$user = Zend_Json_Decoder::decode($this->getRequest()->getParam('user'));
         $t = $this->getRequest()->getRawBody();
         $temp = Zend_Json_Decoder::decode($t, Zend_Json::TYPE_ARRAY);
         $user = new User();
         try {
             $l = Zend_Json_Decoder::decode($t, Zend_Json::TYPE_OBJECT)->login;
             $verified = $user->fetchRow($user->select()->where('login = ?', $l));
             if ($verified->id == 0) {
                 $inserted = $user->insert($temp);
                 $response = $inserted;
                 //$user['name'];
             } else {
                 /* 409 Conflict */
                 $this->getResponse()->setHttpResponseCode(409);
             }
         } catch (Exception $e) {
             $response = $e->getMessage();
         }
         if ($callback) {
             $response = $callback . "(" . $response . ")";
         }
         $view->json = $response;
         $this->render('json');
     } elseif ($method == 'DELETE') {
     } elseif ($method == 'PUT') {
     } else {
         /* 405 Method Not Allowed */
         $this->getResponse()->setHttpResponseCode(405);
     }
 }
예제 #8
0
 function attendeesAction()
 {
     $userTbl = new User();
     // Put the session in the view
     $this->session->putInView($this->view);
     // Check whther an export is required
     if (isset($_REQUEST['export_action'])) {
         $exportRequired = true;
         $exportType = $_REQUEST['export_action'];
     } else {
         $exportRequired = false;
     }
     // load the template
     if (!$exportRequired) {
         $this->view->set_file("content", "attendees.xml");
     } else {
         if ($exportType == Config::EXPORT_EXCEL) {
             $this->view->setFile("content", "attendees_xls.xml");
             $mimeType = "text/xls";
             $exportName = "attendees.xls";
         } else {
             // Default: HTML
             $this->view->setFile("content", "attendees_html.xml");
             $mimeType = "text/plain";
             $exportName = "attendees.html";
         }
     }
     /* Select all the users and list them.
        First extract the 'block' describing a line from the template */
     $this->view->set_block("content", "ATTENDEE", "ATTENDEES");
     $this->view->set_block("content", "GROUPS_LINKS", "LINKS");
     if (isset($_REQUEST['remove'])) {
         $idUser = $this->getRequest()->getParam('id_user');
         // instantiate a PaperRow object. Ok, not elegant, but easier
         $user = $userTbl->find($idUser)->current();
         $user->delete();
     }
     if (isset($_REQUEST['confirm_payment'])) {
         $idUser = $this->getRequest()->getParam('id_user');
         // instantiate a PaperRow object. Ok, not elegant, but easier
         $user = $userTbl->find($idUser)->current();
         $user->payment_received = 'Y';
         $user->save();
     }
     $nbAttendees = 0;
     // Initialize the current interval
     if (!isset($_REQUEST['iMin'])) {
         $iMinCur = 1;
         $iMaxCur = self::SIZE_ATTENDEES_GROUP;
     } else {
         $iMinCur = $_REQUEST['iMin'];
         $iMaxCur = $_REQUEST['iMax'];
     }
     // Export? No group.
     if ($exportRequired) {
         $iMinCur = 0;
         $iMaxCur = 999999999;
     }
     // Get all the attendees, ordered by last name
     $userTbl = new User();
     $users = $userTbl->fetchAll(" roles LIKE '%P%'", "last_name");
     $this->view->mailType = Mail::SOME_USER;
     $i = 0;
     foreach ($users as $user) {
         $i++;
         if ($i >= $iMinCur and $i <= $iMaxCur) {
             // Choose the CSS class
             $this->view->css_class = Config::CssCLass($i);
             $user->putInView($this->view);
             $this->view->choices = "";
             // Get the answer to open questions
             $rAnswers = $this->zmax_context->db->query("SELECT * FROM RegAnswer a, RegQuestion q, " . " RegChoice c WHERE a.id_question = q.id and a.id_user='******' " . " AND a.id_answer=c.id_choice AND c.id_question=q.id");
             while ($answer = $rAnswers->fetch(Zend_Db::FETCH_OBJ)) {
                 $this->view->choices .= "{$answer->question_code}: {$answer->choice}; ";
             }
             $this->view->append("ATTENDEES", "ATTENDEE");
         }
     }
     // Export if required
     if ($exportRequired) {
         $this->view->assign("export", "content");
         $this->exportFile($exportName, $mimeType, $this->view->export);
         return;
     }
     // Create the groups
     $nbAttendees = $i;
     $nb_groups = $nbAttendees / self::SIZE_ATTENDEES_GROUP + 1;
     for ($i = 1; $i <= $nb_groups; $i++) {
         $iMin = ($i - 1) * self::SIZE_ATTENDEES_GROUP + 1;
         if ($iMin >= $iMinCur and $iMin <= $iMaxCur) {
             $link = "<font color=red>{$i}</font>";
         } else {
             $link = $i;
         }
         $this->view->set_var("LINK", $link);
         $this->view->set_var("IMIN_VALUE", $iMin);
         $this->view->set_var("IMAX_VALUE", $iMin + self::SIZE_ATTENDEES_GROUP - 1);
         $this->view->append("LINKS", "GROUPS_LINKS");
     }
     $this->view->nb_attendees = $nbAttendees;
     echo $this->view->render("layout");
 }
예제 #9
0
파일: init.php 프로젝트: knatorski/SMS
} else {
    echo "\n\nParametr app_env jest wymagany!";
    echo "\n\n" . $opts->getUsageMessage() . "\n\n";
    exit;
}
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Base_Controller_Action_Helper_Currentip::$_unitTestEnabled = true;
$application->bootstrap();
$application->getBootstrap()->runForCmd();
Zend_Controller_Front::getInstance()->setParam('bootstrap', $application->getBootstrap());
Zend_registry::set('config', $application->getOptions());
$user = $application->getOption('bin');
$u = new User();
$u_data = $u->fetchAll("login = '******'user'] . "'", "id DESC", 1);
if (null == $u_data) {
    throw new Exception('Brak użytkownika o podanym ID');
}
$u_data = $u_data->toArray();
$storageRow = new stdClass();
foreach ($u_data[0] as $key => $value) {
    $storageRow->{$key} = $value;
}
$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
$o = new Branch();
$data = $o->fetchAll("branch_name = '" . $user['branch'] . "'", "id DESC", 1)->toArray();
$storageRow->jednostka = $data[0];
$storage->write($storageRow);
예제 #10
0
 /**
  * Called by ITechController
  * To view ACLs in an action function use Zend_Auth::getInstance()->getIdentity()->acls; or ITechController::_getACLs();
  */
 public static function getACLs($user_id)
 {
     $rtn = array();
     if ($user_id) {
         $userTable = new User();
         $select = $userTable->select()->setIntegrityCheck(false);
         $select->join(array('uacl' => 'user_to_acl'), 'uacl.user_id = user.id', 'uacl.acl_id');
         $select->where('uacl.user_id = ?', $user_id);
         $rowset = $userTable->fetchAll($select);
         foreach ($rowset as $row) {
             $rtn[] = $row->acl_id;
         }
     }
     return $rtn;
 }
예제 #11
0
파일: User.php 프로젝트: knatorski/SMS
 /**
  * Metoda dla crona do stosowania zaplanowanych blokad użytkowników
  * @return array
  */
 public function deleter()
 {
     $userModel = new User();
     $exceptions = array();
     try {
         $select = $userModel->select()->where('timelock_start IS NOT NULL')->where('timelock_start <= ?', new Zend_Db_Expr('NOW()'))->where('ghost = ?', 'f');
         $users = $userModel->fetchAll($select);
         foreach ($users as $user) {
             $user->ghost = true;
             $user->is_locked = true;
             $user->save();
         }
     } catch (Exception $e) {
         $exceptions[] = $e;
     }
     return $exceptions;
 }
예제 #12
0
파일: index.php 프로젝트: execrot/mongostar
 * @property int     $age
 *
 * @method static User[] fetchAll(array $cond = null, array $sort = null, $count = null, $offset = null, $hint = NULL)
 * @method static User|null fetchOne(array $cond = null, array $sort = null)
 * @method static User fetchObject(array $cond = null, array $sort = null)
 */
class User extends Mongostar_Model
{
}
$newUser = User::fetchObject(array('id' => null));
echo $newUser->name . "<br>";
die("lsjdlksj");
if (rand(0, 1)) {
    // User::remove();
}
$user = User::fetchOne(array('id' => '54de8e1e9cd81ebf330041bc'));
echo $user->name . "<br>";
$user->name = "User_name - " . rand(1000, 9999);
$user->save();
$user = User::fetchOne(array('id' => '54de8e1e9cd81ebf330041bc'));
echo $user->name . "<br>";
die;
$user->name = "Name: " . rand(1000, 9999);
$user->save();
echo "last name: " . $user->name . "<br/>";
$user->name = "Name-edited";
$user->save();
foreach (User::fetchAll() as $user) {
    echo $user->id . ' - ' . $user->name . "<br>";
}
echo "count: " . User::getCount() . "<br>";
예제 #13
0
 public function myresetpasswordAction()
 {
     //check GUID param with database
     //remove all elements, only password and repeat stays
     $this->form = new User_Form_Edit();
     $elems = $this->form->getElements();
     foreach ($elems as $elem) {
         if (!($elem->getName() == User::COL_PASSWORD || $elem->getName() == User_Form_Edit::PASSWORD_CLONE || $elem->getName() == 'submit' || $elem->getName() == User::COL_GUID)) {
             $this->form->removeElement($elem->getName());
         }
     }
     if ($this->getRequest()->isPost()) {
         if ($this->form->isValid($this->getRequest()->getParams())) {
             //update password
             $pass = $this->form->getValue(User::COL_PASSWORD);
             if ($pass != $this->getRequest()->getParam(User_Form_Edit::PASSWORD_CLONE)) {
                 $element = $this->form->getElement(User_Form_Edit::PASSWORD_CLONE);
                 $element->addError("Error: Your password and the repeating don't match.");
                 $this->form->markAsError();
                 return $this->render('form');
             }
             /*
             credit: http://www.geekzilla.co.uk/view8AD536EF-BC0D-427F-9F15-3A1BC663848E.htm
             Author  	: Paul Hayman
             Published 	: 14 June 2006
             */
             $regexStringGuid = "^(\\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\\}{0,1})\$^";
             $vali = new Zend_Validate_Regex($regexStringGuid);
             $userGuid = $this->getRequest()->getParam(User::COL_GUID);
             if ($vali->isValid($userGuid)) {
                 $user = new User();
                 $select = $user->select();
                 $where = $user->getAdapter()->quoteInto(User::COL_GUID . ' = ?', $userGuid, 'string');
                 $select->where($where);
                 $rowset = $user->fetchAll($select);
                 if ($rowset->count() == 1) {
                     $data = array(User::COL_PASSWORD => "{SHA}" . base64_encode(pack("H*", sha1($pass))), User::COL_GUID => null);
                     try {
                         $user->update($data, $where);
                     } catch (Exception $e) {
                         throw new Exception('Error: Password was not changed' . $e->getMessage());
                     }
                 } else {
                     //no or too much users with this GUID!
                     //TODO log in IDS?
                 }
             } else {
                 //param != GUID
                 //TODO log in IDS?
             }
             $this->view->message = 'password was changed';
             $this->render('message');
         } else {
             //not valid
             $this->render('form');
         }
     } else {
         //not post
         $userGuid = $this->getRequest()->getParam(User::COL_GUID);
         $this->form->setValues(array(User::COL_GUID => $userGuid));
         $this->view->form = $this->form;
         $this->render('form');
     }
 }
예제 #14
0
파일: user.php 프로젝트: Aksaxena/mlm
<?php

session_start();
require_once "../lib/config.inc.php";
require_once "../lib/classes/Admin.php";
require_once "../lib/classes/User.php";
require_once "../lib/functions.inc.php";
require_once "../lib/pagingClass.php";
$UserObj = new User();
$adminObj = new Admin();
$adminObj->validateAdmin();
$UserList = $UserObj->fetchAll($_GET);
$pagingObj = new PagingClass2($obj->NumRows($UserObj->fetchAllUsers()), 10);
// user want to change status as Active or Inactive
if (isset($_GET['uid']) && $_GET['uid'] != null && (isset($_GET['q']) && $_GET['q'] == 'trash')) {
    $UserObj->statusRemove(intval($_GET['uid']));
}
// when user want to remove and transfer in trash
if (isset($_POST['uid']) && $_POST['uid'] != null && (isset($_POST['action']) && $_POST['action'] != null)) {
    $result = $UserObj->modifyStatus($_POST);
    echo $result;
    die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
예제 #15
0
 /**
  *
  * Manage the list of program committee members
  *
  */
 function usersAction()
 {
     $texts =& $this->zmax_context->texts;
     // Create the infos for the filter list
     if (isset($_POST['filter_roles'])) {
         $filterRoles = array_flip($_POST['filter_roles']);
     } else {
         // Show only reviewers
         $filterRoles = array_flip(array("R"));
     }
     if (isset($_POST['mail_filter'])) {
         $this->view->mail_filter = $_POST['mail_filter'];
         $mailCriteria = " email LIKE '%{$this->view->mail_filter}%' ";
     } else {
         $this->view->mail_filter = "";
         $mailCriteria = " 1 ";
     }
     if (isset($_POST['name_filter'])) {
         $this->view->name_filter = $_POST['name_filter'];
         $nameCriteria = " last_name LIKE '%{$this->view->name_filter}%' ";
     } else {
         $this->view->name_filter = "";
         $nameCriteria = " 1 ";
     }
     $this->view->filter_roles_list = Zmax_View_Phplib::checkboxField("checkbox", "filter_roles[]", Config::$Roles, $filterRoles, array());
     $filterRolesList = "";
     $connector = "";
     foreach (array_flip($filterRoles) as $role) {
         $filterRolesList .= " {$connector} roles LIKE '%{$role}%' ";
         $connector = " OR ";
     }
     $user = new User();
     $request = $this->getRequest();
     $email = $request->getParam('email');
     // Check whether an export is required
     if (isset($_REQUEST['export_action'])) {
         $exportRequired = true;
         $exportType = $_REQUEST['export_action'];
     } else {
         $exportRequired = false;
     }
     // load the template
     if (!$exportRequired) {
         $this->view->setFile("content", "users.xml");
         $this->view->setBlock("content", "post_message", " ");
     } else {
         if ($exportType == Config::EXPORT_EXCEL) {
             $this->view->setFile("content", "members_xls.xml");
             $mimeType = "text/xls";
             $exportName = "members.xls";
         } else {
             // Default: HTML
             $this->view->setFile("content", "members_html.xml");
             $mimeType = "text/plain";
             $exportName = "members.html";
         }
     }
     // After submission, insert
     if (isset($_REQUEST['id_user'])) {
         $idUser = $request->getParam("id_user");
         if (!isset($_POST['form_mode'])) {
             // The user exists. It must be modified or removed
             $instr = $request->getParam("instr");
             $userRow = $user->find($idUser)->current();
             if ($instr == "modify") {
                 // Just show the form with default values
                 $this->view->pcmember_message = "Modify user infos";
                 $this->view->form_action = $texts->form->update;
                 $this->view->form_mode = "update";
                 $userRow->putInView($this->view);
             } else {
                 if ($instr == "remove") {
                     $this->view->pcmember_message = "User {$email} has been removed";
                     $this->view->form_action = $texts->form->insert;
                     $this->view->form_mode = "insert";
                     $userRow->delete();
                     // Create a new user for insertion
                     $userRow = $user->createRow();
                     $userRow->roles = User::REVIEWER_ROLE;
                     $userRow->putInView($this->view);
                 }
             }
         } else {
             // Data comes from the form
             $form_mode = $request->getParam("form_mode");
             if ($form_mode == "insert") {
                 $userRow = $user->createRow();
             } else {
                 $userRow = $user->find($idUser)->current();
             }
             $this->view->form_action = $texts->form->update;
             $userRow->email = $_POST['email'];
             $userRow->first_name = $_POST['first_name'];
             $userRow->last_name = $_POST['last_name'];
             if (isset($_POST['topics'])) {
                 $userRow->setTopicsFromArray($_POST['topics']);
             }
             if (isset($_POST['roles'])) {
                 $userRow->setRolesFromArray($_POST['roles']);
             }
             $messages = $userRow->checkValues($this->zmax_context->texts, array("affiliation", "address", "city", "zip_code"));
             // Any error ?
             if (count($messages) > 0) {
                 $this->view->setFile("error", "error.xml");
                 $this->view->setBlock("error", "ERROR", "ERRORS");
                 foreach ($messages as $message) {
                     $this->view->message = $message;
                     $this->view->append("ERRORS", "ERROR");
                 }
                 $this->view->assign("pcmember_message", "ERRORS");
                 $this->view->form_mode = $form_mode;
             } else {
                 /* Everything is OK. Save and display the form with the user */
                 $userRow->save();
                 $this->view->assign("pcmember_message", "post_message");
             }
             // Always put the current data in the view
             $userRow->putInView($this->view);
         }
     } else {
         /* Display the form with an empty user*/
         $this->view->pcmember_message = "";
         $this->view->form_action = $texts->form->insert;
         $this->view->form_mode = "insert";
         $userRow = $user->createRow();
         $userRow->roles = User::REVIEWER_ROLE;
         $userRow->putInView($this->view);
     }
     // We are ready to instantiate the form
     $this->view->form_reviewer = $userRow->form($this->view, "form_reviewer.xml");
     $this->view->someUser = Mail::SOME_USER;
     /* Select all the members and list them.
     		 First extract the 'block' describing a line from the template */
     $this->view->setBlock("content", "MEMBER", "MEMBERS");
     $pcmembers = $user->fetchAll("{$mailCriteria} AND {$nameCriteria} AND ({$filterRolesList})", 'last_name');
     $i = 0;
     foreach ($pcmembers as $member) {
         $member->putInView($this->view);
         // Choose the CSS class
         $this->view->css_class = Config::CssCLass($i++);
         $this->view->append("MEMBERS", "MEMBER");
     }
     if ($exportRequired) {
         $this->view->assign("export", "content");
         $this->exportFile($exportName, $mimeType, $this->view->export);
         return;
     }
     // Show the view
     echo $this->view->render("layout");
 }
예제 #16
0
 /**
  * Send a mail (or several mails)
  * @author philipperigaux
  *
  */
 function send()
 {
     // Look at the mail type
     switch ($this->_mailType) {
         case Mail::SOME_USER:
             $user = new User();
             $userRow = $user->findByEmail($this->_to);
             if (!is_object($userRow)) {
                 // echo "Unknown user: "******"<br/>";
             } else {
                 $userRow->putInView($this->_view);
             }
             $this->_view->assign("message", "template");
             // Send the mail
             $this->sendMail($this->_to, $this->_subject, $this->_view->message, $this->_from, $this->_from, $this->_from);
             break;
         case Mail::ALL_REVIEWERS:
         case Mail::ALL_AUTHORS:
         case Mail::ALL_PARTICIPANTS:
             // Determine the role from the mail type
             if ($this->_mailType == Mail::ALL_REVIEWERS) {
                 $role = "%R%";
             } else {
                 if ($this->_mailType == Mail::ALL_AUTHORS) {
                     $role = "%A%";
                 } else {
                     if ($this->_mailType == Mail::ALL_PARTICIPANTS) {
                         $role = "%P%";
                     }
                 }
             }
             $user = new User();
             $userRows = $user->fetchAll("roles LIKE '{$role}' ");
             foreach ($userRows as $userRow) {
                 // Instanciate all variables present in reviewers messages
                 $userRow->putInView($this->_view);
                 // instantiate the message
                 $this->_view->assign("message", "template");
                 $this->sendMail($userRow->email, $this->_subject, $this->_view->message, $this->_from, $this->_from);
             }
             break;
         case Mail::ALL_AUTHORS_ACCEPTED:
             // Loop on the contact authors of accepted papers,
             // instanciate and send the mail
             $qPapers = "SELECT p.* FROM PaperStatus s, Paper p " . "WHERE p.status=s.id and cameraReadyRequired='Y' ";
             $rPapers = $this->_db->query($qPapers);
             while ($paper = $rPapers->fetch(Zend_Db::FETCH_OBJ)) {
                 $subjectWithID = "Submission " . $paper->id . "-- " . $this->_subject;
                 $to = $paper->emailContact;
                 $this->_view->assign("message", "template");
                 // Send the free mail text
                 $this->sendMail($to, $subjectWithID, $this->_view->message, $this->_from, $this->_from, $this->_config->chairMail);
             }
             break;
         default:
             echo "Send mail: INVALID SEND MODE. CANNOT CONTINUE <br/>";
             exit;
     }
 }
예제 #17
0
function SummaryPapersAssignment(&$tpl, $db, &$TEXTS)
{
    $registry = Zend_registry::getInstance();
    $config = $registry->get("Config");
    $config->putInView($tpl);
    $db = Zend_Db_Table::getDefaultAdapter();
    $paperTbl = new Paper();
    $reviewTbl = new Review();
    $ratingTbl = new Rating();
    $userTbl = new User();
    /* Check whether there is a prefered topic for papers */
    if ($config->selectedPaperTopic) {
        $prefPaperTopic = $config->selectedPaperTopic;
    } else {
        $prefPaperTopic = "%";
    }
    /* Check whether there is a prefered topic for reviewers */
    if ($config->selectedReviewerTopic) {
        $prefReviewerTopic = $config->selectedReviewerTopic;
    } else {
        $prefReviewerTopic = "%";
    }
    // Decompose the blocks of the template
    $tpl->set_block("content", "MEMBER_DETAIL", "MEMBERS");
    $tpl->set_block("content", "PAPER_DETAIL", "PAPERS");
    $tpl->set_block("content", "NAVIGATION_TABLE", "NAVIGATION");
    $tpl->set_block("PAPER_DETAIL", "ASSIGNMENT_DETAIL", "ASSIGNMENTS");
    // Get the list of topics
    $topicList = $db->fetchPairs("SELECT id, label FROM ResearchTopic");
    $topicList["0"] = "Any";
    ksort($topicList);
    // Show the selection list
    $tpl->paper_topics = Zmax_View_Phplib::selectField("paperTopic", $topicList, $prefPaperTopic);
    $tpl->reviewer_topics = Zmax_View_Phplib::selectField("reviewerTopic", $topicList, $prefReviewerTopic);
    /* Store the list of reviewers in an array (+easier, +efficient).  */
    $members = array();
    $nb_members = 0;
    $users = $userTbl->fetchAll("roles LIKE '%R%'", "last_name");
    foreach ($users as $user) {
        if ($prefReviewerTopic == '%' or $user->matchTopic($prefReviewerTopic)) {
            $members[++$nb_members] = $user;
        }
    }
    // Same thing for papers
    $papers = array();
    $nb_papers = 0;
    $rPapers = $db->query("SELECT * FROM Paper ORDER BY id");
    while ($paper = $rPapers->fetch(Zend_Db::FETCH_OBJ)) {
        if ($prefPaperTopic == '%' or $paper->topic == $prefPaperTopic) {
            $papers[++$nb_papers] = $paper;
        }
    }
    // Manage the navigation table
    if ($nb_papers > MAX_ITEMS_IN_ASSIGNMENT or $nb_members > MAX_ITEMS_IN_ASSIGNMENT) {
        // Show the navigation table
        $tpl->set_var("nb_paper", $nb_papers);
        $tpl->set_var("nb_reviewers", $nb_members);
        $tpl->set_var("max_items_in_assignment", MAX_ITEMS_IN_ASSIGNMENT);
        if (isset($_REQUEST['i_paper_min'])) {
            // The request comes from the navigation table
            $i_paper_min = $_REQUEST['i_paper_min'];
            $i_paper_max = min($_REQUEST['i_paper_max'], $nb_papers);
            $i_member_min = $_REQUEST['i_member_min'];
            $i_member_max = min($_REQUEST['i_member_max'], $nb_members);
        } else {
            $i_paper_min = 1;
            $i_paper_max = min($nb_papers, MAX_ITEMS_IN_ASSIGNMENT);
            $i_member_min = 1;
            $i_member_max = min($nb_members, MAX_ITEMS_IN_ASSIGNMENT);
        }
        // Show the navigation table
        $tpl->set_var("NAV_TABLE", "");
        $lines = "";
        $script = $tpl->base_url . "/admin/chair/showassignment?1=1";
        for ($i = 1; $i <= $nb_papers; $i += MAX_ITEMS_IN_ASSIGNMENT) {
            $line = "";
            for ($j = 1; $j <= $nb_members; $j += MAX_ITEMS_IN_ASSIGNMENT) {
                $link = $script . "&i_paper_min={$i}" . "&i_paper_max=" . ($i + MAX_ITEMS_IN_ASSIGNMENT - 1) . "&i_member_min={$j}" . "&i_member_max=" . ($j + MAX_ITEMS_IN_ASSIGNMENT - 1);
                if ($i == $i_paper_min and $j == $i_member_min) {
                    $line .= "<td bgcolor=lightblue><a href='{$link}'>" . "<font color=white>{$i}/{$j}</font></a></td>";
                } else {
                    $line .= "<td><a href='{$link}'>{$i}/{$j}</a></td>";
                }
            }
            $lines .= "<tr>{$line}</tr>\n";
        }
        $tpl->set_var("NAV_TABLE", $lines);
        $tpl->append("NAVIGATION", "NAVIGATION_TABLE");
    } else {
        // Hide the navigation table
        $i_paper_min = $i_member_min = 1;
        $i_paper_max = $nb_papers;
        $i_member_max = $nb_members;
        $tpl->set_var("NAVIGATION", "");
    }
    // Put the current values in the template
    $tpl->set_var("I_PAPER_MIN", $i_paper_min);
    $tpl->set_var("I_PAPER_MAX", $i_paper_max);
    $tpl->set_var("I_MEMBER_MIN", $i_member_min);
    $tpl->set_var("I_MEMBER_MAX", $i_member_max);
    //  echo "I paper min=$i_paper_min I paper max = $i_paper_max<br>";
    // OK, now create the table. First the columns' headers
    for ($j = $i_member_min; $j <= $i_member_max; $j++) {
        $members[$j]->putInView($tpl);
        $tpl->member_nb_papers = $members[$j]->countPapers();
        $tpl->append("MEMBERS", "MEMBER_DETAIL");
    }
    // then each line
    $tpl->PAPERS = "";
    for ($i = $i_paper_min; $i <= $i_paper_max; $i++) {
        // Choose the CSS class
        if ($i % 2 == 0) {
            $tpl->set_var("css_class", "even");
        } else {
            $tpl->set_var("css_class", "odd");
        }
        $paper = $papers[$i];
        $entity = "Paper" . "->id";
        $tpl->setVar($entity, $papers[$i]->id);
        $tpl->SESSION_ID = session_id();
        // Get the ratings of each PC member
        $nbReviewers = 0;
        for ($j = $i_member_min; $j <= $i_member_max; $j++) {
            $member = $members[$j];
            $member->putInView($tpl);
            $rating = $ratingTbl->find($paper->id, $member->id)->current();
            if ($rating) {
                $val = $rating->rate;
            } else {
                $val = 2;
            }
            $tpl->bg_color = "white";
            $tpl->set_var("paper_rating", $val);
            $tpl->set_var("CHECKED_YES", "");
            $tpl->set_var("CHECKED_NO", "checked='1'");
            // Check if the paper is assigned
            $review = $reviewTbl->find($paper->id, $member->id)->current();
            if ($review) {
                $nbReviewers = $nbReviewers + 1;
                $tpl->bg_color = "yellow";
                $tpl->set_var("CHECKED_YES", "checked='1'");
                $tpl->set_var("CHECKED_NO", "");
            }
            // Add to the assignment line
            $tpl->append("ASSIGNMENTS", "ASSIGNMENT_DETAIL");
        }
        // Add to the list of papers
        $tpl->setVar("paper_nb_reviewers", $nbReviewers);
        $tpl->append("PAPERS", "PAPER_DETAIL");
        $tpl->set_var("ASSIGNMENTS", "");
    }
}
예제 #18
0
 /**
  * Exibe uma lista com todos os usuários registrados
  *
  * @return void
  */
 public function listAction()
 {
     $this->view->users = $this->_model->fetchAll();
 }
예제 #19
0
 public function doGet()
 {
     $view = $this->initView();
     $callback = $this->getRequest()->getParam('callback');
     $id = $this->getRequest()->getParam('id');
     $date = $this->getRequest()->getParam('date');
     $user = new User();
     if ($id) {
         $s = 'id';
         if (!is_numeric($id)) {
             $s = 'login';
         }
         $row = $user->fetchRow($user->select()->where($s . ' = ?', $id));
         if (is_null($row)) {
             /* 404 Not Found */
             $this->getResponse()->setHttpResponseCode(404);
         } else {
             $response = Zend_Json_Encoder::encode($row->toArray());
         }
     } else {
         $rows = $user->fetchAll();
         $users = $rows->toArray();
         if ($users == 0) {
             /* 404 Not Found */
             $this->getResponse()->setHttpResponseCode(404);
         } else {
             /*foreach ($users as &$u) {
             			$u['teste'] = $id.' - '.$date;
             		}*/
             $response = Zend_Json_Encoder::encode($users);
         }
     }
     if ($callback) {
         $response = $callback . "(" . $response . ")";
     }
     $view->json = $response;
     $this->render('json');
 }
예제 #20
0
 static function getUserListPage()
 {
     $users = User::fetchAll();
     echo self::render('userListPage', array('users' => $users));
 }
예제 #21
0
 /**
  * Compute the automatic assignment of papers
  *
  */
 function computeassignmentAction()
 {
     $paperTbl = new Paper();
     $userTbl = new User();
     $ratingTbl = new Rating();
     $assignmentTbl = new Assignment();
     // Form has been posted? Store the new assignment
     if (isset($_POST['commitAssignment'])) {
         if (isset($_POST['idMin'])) {
             // Commit for a group
             $idMin = $_POST['idMin'];
             $idMax = $_POST['idMax'];
         } else {
             $idMin = $idMax = -1;
         }
         $this->commitAssignment($idMin, $idMax, $this->db_v1);
         $this->view->set_file("content", "index.xml");
         $this->view->initial_message = "Assignment committed!";
         // SummaryPapersAssignment (&$this->view, $this->db_v1);
     } else {
         if ($this->config->assignment_mode == Config::TOPIC_BASED) {
             // Assignment based on topics
             $this->view->setFile("content", "topicbased.xml");
             $this->view->setBlock("content", "MEMBER", "MEMBERS");
             $this->view->setBlock("MEMBER", "PAPER", "PAPERS");
             $this->zmax_context->db->query("DELETE FROM Assignment");
             // Loop on PC members
             $members = $userTbl->fetchAll("roles LIKE '%R%'");
             $i = 0;
             foreach ($members as $member) {
                 $member->putInView($this->view);
                 $this->view->PAPERS = "";
                 $nbPapers = 0;
                 // Loop on papers that match the reviewer's topics
                 $qPapers = "SELECT p.* FROM Paper p, UserTopic s " . " WHERE p.topic=s.id_topic  AND s.id_user='******' ";
                 $rPapers = $this->zmax_context->db->query($qPapers);
                 while ($p = $rPapers->fetch(Zend_Db::FETCH_OBJ)) {
                     // instantiate a PaperRow object. Ok, not elegant, but easier
                     $paper = $paperTbl->find($p->id)->current();
                     // Check whether there is a conflict
                     $comments = "";
                     $conflict = $paper->checkConflictWithuser($member, $comments);
                     if ($conflict) {
                         $this->view->PAPERS .= "<li>{$comments}</li>";
                     } else {
                         $paper->putInView($this->view);
                         $nbPapers++;
                         // OK, now save the rating
                         $assignment = $assignmentTbl->createRow();
                         $assignment->idPaper = $paper->id;
                         $assignment->id_user = $member->id;
                         $assignment->weight = 5;
                         $assignment->save();
                         $this->view->append("PAPERS", "PAPER");
                     }
                     if ($nbPapers >= 4) {
                         break;
                     }
                 }
                 // Loop on papers
                 $this->view->nb_papers = $nbPapers;
                 $this->view->append("MEMBERS", "MEMBER");
             }
             // End of loop on users
         } else {
             // Assignment based on reviewers preferences
             $this->view->set_file("content", "computeassignment.xml");
             $this->view->set_file("assigngroup", "assigngroup.xml");
             // Compute and propose the assignment
             if (isset($_GET['nbRev'])) {
                 $maxReviewers = $_GET['nbRev'];
             } else {
                 $maxReviewers = $this->config->nbReviewersPerItem;
             }
             ComputeAssignment($this->view, $this->db_v1, $maxReviewers);
         }
     }
     echo $this->view->render("layout");
 }
예제 #22
0
 public function showAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $id = $this->_helper->IdConvert->hexToStr($id);
     $logic = new Logic_Branch();
     $logicUser = new Logic_User();
     $userModel = new User();
     $profileRole = new ProfileRole();
     $select = $logicUser->getUsersInBranch($id);
     $user_data = $userModel->fetchAll($select)->toArray();
     $config = Zend_Registry::get('config');
     foreach ($user_data as $key => $value) {
         $ru = $profileRole->fetchAll("id_profile = " . $value['profile_id'])->toArray();
         if ($value['role_count'] == 1 && $ru[0]['id_role'] == $config['role']['assistant']) {
             unset($user_data[$key]);
         }
     }
     $data = array();
     try {
         $data = $logic->showBranch($id);
         $headers = $data->getHeaderMappings();
         $this->view->advisers = count($user_data);
         $headers['advisers'] = array('title' => 'Ilość doradców', 'sort' => false);
     } catch (Logic_Branch_Exception $e) {
         $this->_helper->messenger->error();
         $this->_helper->redirector('index');
         return;
     }
     if ($data['map_image'] != "") {
         $data['map_image'] = '<img src="/static/img/' . $data['map_image'] . '" />';
     }
     $this->view->data = $data;
     $this->view->data_headers = $headers;
 }
예제 #23
0
 function exportProgramCommittee($templateFile)
 {
     // Load the template
     $this->_view->setFile("member", $templateFile);
     $userTbl = new User();
     $this->_view->list_pc = "";
     $members = $userTbl->fetchAll("roles LIKE '%R%'");
     foreach ($members as $member) {
         $member->putInView($this->_view);
         $this->_view->append("list_pc", "member");
     }
     $contents = $this->_view->list_pc;
     $this->replaceBadChars($contents);
     return $contents;
 }