Example #1
0
 function showUsers($message)
 {
     $returnStr = $this->showSysAdminHeader(Language::messageSMSTitle());
     $returnStr .= '<div id="wrap">';
     $returnStr .= $this->showNavBar();
     $returnStr .= '<div class="container"><p>';
     $returnStr .= '<ol class="breadcrumb">';
     $returnStr .= '<li>' . Language::headerUsers() . '</li>';
     $returnStr .= '</ol>';
     $returnStr .= $message;
     $returnStr .= '<div id=usersdiv>';
     $returnStr .= '</div>';
     $usertype = loadvar('usertype', USER_INTERVIEWER);
     $users = new Users();
     if ($usertype == "-1") {
         $returnStr .= $this->showUsersList($users->getUsers());
     } else {
         $returnStr .= $this->showUsersList($users->getUsersByType($usertype));
     }
     $returnStr .= '<a href="' . setSessionParams(array('page' => 'sysadmin.users.adduser')) . '">' . Language::labelUserAddUser() . '</a>';
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     $returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter(false);
     return $returnStr;
 }
Example #2
0
 public function actionDisplay()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $this->addBarTitle("Grant user <small>[list]</small>", "user");
     global $user;
     $model = new Users();
     $groupID = $user->groupID;
     $groupID = Request::getVar('filter_group', 0);
     if ($groupID == 0) {
         $list_user = $model->getUsers(null, null, true);
     } else {
         $list_user = $model->getUsers($groupID);
     }
     $lists = $model->getList();
     $arr_group = $model->getGroups();
     $this->render('list', array("list_user" => $list_user, 'arr_group' => $arr_group, "lists" => $lists));
 }
function displayGridAllUsers()
{
    ?>
    <!-- div contenant la liste des utilisateurs-->
    <div id="utilisateurs" class="panel panel-default" hidden>
        <!-- Table -->
        <table class="table">
            <thead>
                <tr>
                    <th>Nom</th>
                    <th>Prénom</th>
                    <th>Login</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <?php 
    foreach (Users::getUsers() as $u) {
        ?>
                <tr>
                    <td>
                        <?php 
        echo escape($u->lastname);
        ?>
                    </td>
                    <td>
                        <?php 
        echo escape($u->firstname);
        ?>
                    </td>
                    <td>
                        <?php 
        echo escape($u->login);
        ?>
                    </td>
                    <td>
                        <a class="btn btn-info btn-xs" href=".?page=edit&login=<?php 
        echo $u->login;
        ?>
" title="Editer" role="button"><span class="glyphicon glyphicon-edit"></span></a>
                        <a class="btn btn-danger btn-xs" href=".?page=delete&login=<?php 
        echo $u->login;
        ?>
" title="Supprimer" role="button"><span class="glyphicon glyphicon-remove"></span></a>
                    </td>
                </tr>
                <?php 
    }
    ?>
        </table>
    </div>
    <?php 
}
Example #4
0
 public function actionShowUsers()
 {
     $auth = Auth::checkAuth();
     $view = new View();
     $view->auth = $auth;
     if ($auth) {
         $user = Auth::getUser();
         if ($user->user_group == 1) {
             $view->user_login = $user->user_login;
             $view->user_group = $user->user_group;
             $view->users = Users::getUsers();
             $view->display('header.php');
             $view->display('users/user_list.php');
         }
         $view->display('footer.php');
     } else {
         header("Location: /learns/");
     }
 }
Example #5
0
 /**
  * Edit a users
  */
 public function editAction()
 {
     $usersModel = new Users();
     $form = $this->_getForm(false);
     $user = $usersModel->getUser($this->_getParam('userId'));
     $form->setDefaults($user);
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         $data = $form->getValues();
         if ($usersModel->isUserNameInUse($data['user_name'], $user['user_id'])) {
             $form->getElement('user_name')->addValidator('customMessages', false, array('Username is already in use'));
         }
         if ($usersModel->isEmailInUse($data['user_email'], $user['user_id'])) {
             $form->getElement('user_email')->addValidator('customMessages', false, array('E-Mail is already in use'));
         }
         if ($form->isValid($_POST)) {
             $password = !empty($data['user_password']) ? $data['user_password'] : null;
             $usersModel->updateUser($user['user_id'], $data['user_name'], $data['user_email'], $data['user_role'], $password);
             $this->_helper->getHelper('Redirector')->gotoRouteAndExit(array(), 'users-index');
         }
     }
     $this->view->form = $form;
     $this->view->users = $usersModel->getUsers();
 }
 private function _registerSession($user_id)
 {
     $user = Users::getUsers($user_id);
     $this->session->set('user', array('first_name' => $user['first_name'], 'last_name' => $user['last_name']));
     $this->session->set('auth', array('id' => $user_id, 'station_id' => $user['station_id']));
 }
Example #7
0
});
$app->delete('/api/contacts/:id', function ($id) {
    $cn = new Contacts();
    $cn->deleteContact($id);
});
$app->get('/api/contacts/:id/venues', function ($id) {
    $cn = new Venues();
    $cn->getVenuesByContactId($id);
});
$app->get('/api/locations/', function () {
    $cn = new Locations();
    $cn->getLocations();
});
$app->get('/api/users/', function () {
    $cn = new Users();
    $cn->getUsers();
});
$app->post('/api/users/', function () use($app) {
    $req = $app->request();
    $bdy = $req->getBody();
    $user = json_decode($bdy);
    $cn = new Users();
    $cn->insertUsers($user[0]);
});
$app->get('/api/users/:id', function ($id) {
    $cn = new Users();
    $cn->getUsersById($id);
});
$app->put('/api/users/:id', function ($id) use($app) {
    $req = $app->request();
    $bdy = $req->getBody();
Example #8
0
 function actionRemove()
 {
     global $user;
     $model = new Group();
     $mode_user = new Users();
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to add/edit group");
         $this->redirect(Router::buildLink("users", array('view' => 'group')));
     }
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         $obj_table = YiiUser::getInstance();
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $list_user = $mode_user->getUsers($cid, null, true);
             $list_group = $model->getItems($cid);
             if (empty($list_user) and empty($list_group)) {
                 $obj_table->removeGroup($cid);
             } else {
                 YiiMessage::raseNotice("Group user have something account/sub group");
                 $this->redirect(Router::buildLink("users", array('view' => 'group')));
                 return false;
             }
         }
     }
     YiiMessage::raseSuccess("Successfully delete GroupUser(s)");
     $this->redirect(Router::buildLink("users", array("view" => "group")));
 }
Example #9
0
        if ($_POST['newpw'] == $_POST['newpw2']) {
            $change = $auth->changePassword($_SESSION['auth']['user'], $_POST['oldpw'], $_POST['newpw']);
            if ($change == false) {
                $smarty->assign('error', 'Unable to change password. Please try again');
            } else {
                $smarty->assign('error', 'Your password has been changed');
            }
        } else {
            $smarty->assign('error', 'New passwords do not match');
        }
    }
    if (!empty($_POST['user']) && !empty($_POST['pass'])) {
        $add = $users->createUser($_POST['user'], $_POST['pass']);
        if ($add != false) {
            header('Location: users.php');
        }
        $smarty->assign('error', 'Unable to create user. Please try again');
    }
}
if (!empty($_GET['delete'])) {
    $delete = $users->deleteUser($_GET['delete']);
    if ($delete != false) {
        header('Location: users.php');
    }
    $smarty->assign('error', 'Unable to delete the user. Please try again');
}
$allusers = $users->getUsers();
$smarty->assign('users', $allusers);
$smarty->display('_header.tpl');
$smarty->display('users.tpl');
$smarty->display('_footer.tpl');
Example #10
0
function initBrowseProposalsLayout()
{
    $org_id = 0;
    $apply_projects = vals_soc_access_check('dashboard/projects/apply') ? 1 : 0;
    $rate_projects = Users::isSuperVisor();
    $browse_proposals = vals_soc_access_check('dashboard/proposals/browse') ? 1 : 0;
    $proposal_tabs = array();
    if (isset($_GET['organisation'])) {
        $org_id = $_GET['organisation'];
    }
    if ($apply_projects && !$browse_proposals) {
        //A student may only browse their own proposals
        $student_id = $GLOBALS['user']->uid;
        $student = Users::getStudentDetails($student_id);
        $inst_id = $student->inst_id;
        $student_section_class = 'invisible';
    } else {
        $student_section_class = '';
        $student_id = 0;
        if (isset($_GET[_STUDENT_TYPE])) {
            $student_id = $_GET[_STUDENT_TYPE];
        }
        $inst_id = 0;
        if (isset($_GET['institute'])) {
            $inst_id = $_GET['institute'];
        }
    }
    ?>
<div class="filtering" style="width: 800px;">
	<span id="infotext" style="margin-left: 34px"></span>
	<form id="proposal_filter">
        <?php 
    echo t('Select the proposals');
    ?>
:
        <?php 
    // echo t('Organisations');
    ?>
        <select id="organisation" name="organisation">
			<option <?php 
    echo !$org_id ? 'selected="selected"' : '';
    ?>
				value="0"><?php 
    echo t('All Organisations');
    ?>
</option><?php 
    $result = Organisations::getInstance()->getOrganisationsLite();
    foreach ($result as $record) {
        $selected = $record->org_id == $org_id ? 'selected="selected" ' : '';
        echo '<option ' . $selected . 'value="' . $record->org_id . '">' . $record->name . '</option>';
    }
    ?>
        </select> <span id='student_section'
			class='<?php 
    echo $student_section_class;
    ?>
'> <select id="institute"
			name="institute">
				<option <?php 
    echo !$inst_id ? 'selected="selected"' : '';
    ?>
					value="0"><?php 
    echo t('All Institutes');
    ?>
</option><?php 
    $result = Groups::getGroups(_INSTITUTE_GROUP, 'all');
    foreach ($result as $record) {
        $selected = $record->inst_id == $inst_id ? 'selected="selected" ' : '';
        echo '<option ' . $selected . 'value="' . $record->inst_id . '">' . $record->name . '</option>';
    }
    ?>
	        </select> <select id="student" name="student">
				<option <?php 
    echo !$student_id ? 'selected="selected"' : '';
    ?>
					value="0"><?php 
    echo t('All Students');
    ?>
</option><?php 
    $result = Users::getUsers(_STUDENT_TYPE, $inst_id ? _INSTITUTE_GROUP : 'all', $inst_id);
    foreach ($result as $record) {
        $selected = $record->uid == $student_id ? 'selected="selected" ' : '';
        echo '<option ' . $selected . 'value="' . $record->uid . '">' . $record->name . ':' . $record->mail . '</option>';
    }
    ?>
	        </select>
		</span>
	</form>
</div>
<div id="TableContainer" style="width: 800px;"></div>
<script type="text/javascript">

		jQuery(document).ready(function($){

			//We make the ajax script path absolute as the language module might add a language code
			//to the path
			window.view_settings = {};
			window.view_settings.apply_projects = <?php 
    echo $apply_projects ? 1 : 0;
    ?>
;
			window.view_settings.rate_projects  = <?php 
    echo $rate_projects ? 1 : 0;
    ?>
;

			function loadFilteredProposals(){
				$("#TableContainer").jtable("load", {
        			student: $("#student").val(),
                                organisation: $("#organisation").val(),
        			institute: $("#institute").val()
        		});
			}

		    //Prepare jTable
			$("#TableContainer").jtable({
				//title: "Table of proposals",
				paging: true,
				pageSize: 10,
				sorting: true,
				defaultSorting: "pid ASC",
				actions: {
					listAction: moduleUrl + "actions/proposal_actions.php?action=list_proposals"
				},
				fields: {
					proposal_id: {
						key: true,
						create: false,
						edit: false,
						list: false
					},
					pid: {
						width: "2%",
    					title: "Project",
						sorting: true,
    					display: function (data) {
							return "<a title=\"View project details\" href=\"javascript:void(0);\" onclick=\"getProjectDetail("+data.record.pid+");\">"+
									"<span class=\"ui-icon ui-icon-info\"></span></a>";
    					},
    					create: false,
    					edit: false
					},
					owner_id: {
						title: "Student",
						width: "30%",
						display: function (data){
							if(data.record.name){
								return data.record.name;
							}else{
								return data.record.u_name;
							}
						}
					},
					inst_id: {
						title: "Institute",
						width: "26%",
						create: false,
						edit: false,
						display: function (data){return data.record.i_name;}
					},
					org_id: {
						title: "Organisation",
						width: "20%",
						display: function (data){return data.record.o_name;}
					},

					solution_short : {//the key of the object is misused to show this column
						//width: "2%",
    					title: "Proposal details",
						sorting: false,
    					display: function (data) {
							return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
								"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
									"<span class=\"ui-icon ui-icon-info\">See details</span></a>";
    					},

    					create: false,
    					edit: false
					},

				},
			});

			//Load proposal list from server on initial page load
			loadFilteredProposals();

			$("#organisation").change(function(e) {
           		e.preventDefault();
           		loadFilteredProposals();
        	});

			$("#institute").change(function(e) {
           		e.preventDefault();
           		loadFilteredProposals();
        	});

			$("#student").change(function(e) {
				e.preventDefault();
				loadFilteredProposals();
			});

			$("#proposal_filter").submit(function(e){
				e.preventDefault();
				loadFilteredProposals()
			});

			// define these at the window level so that they can still be called once loaded in the modal
			//window.getProposalFormForProject = getProposalFormForProject;
			//window.getProjectDetail = getProjectDetail;
			//window.getProposalDetail = getProposalDetail;

		});
	</script><?php 
}
Example #11
0
<?php

include_once 'users.php';
$map = new Users();
$map->getUsers();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=true"></script>
    <script type="text/javascript" src="js/bootstrap.js"></script>
    <script type="text/javascript" src="js/script.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/gmaps.js"></script>
    <link href="css/style.css" rel="stylesheet">
    <script type="text/javascript">
        $(document).ready(function(){

           var map = new GMaps({
                div: '#map',
                lat: -12.043333,
                lng: -77.028333
            });
            $('#geocoding_form').submit(function(e){
                e.preventDefault();
                GMaps.geocode({
                    address: $('#address').val().trim(),
                    callback: function(results, status){
                        if(status=='OK'){
Example #12
0
 public static function deleteUser($id)
 {
     $user = new Users();
     $links = Users::getUsers($id);
     if (count($links) > 0) {
         if ($links['from_users_message'] > 0 || $links['from_message'] > 0 || $links['from_package_transport_history'] > 0 || $links['from_package_vcs'] > 0) {
             return array('class' => 'alert-warning', 'text' => "<p>Запись <b> " . $links['first_name'] . " " . $links['last_name'] . " не</b> может быть <b>удалена</b>, так как связана с одной или несколькими записями. Необходимо <b>переопределить</b> или <b>удалить</b> эти связи, после чего повторите попытку.</p>");
         } else {
             $query = "DELETE FROM users WHERE id = {$id}";
             $res = new Phalcon\Mvc\Model\Resultset\Simple(null, $user, $user->getReadConnection()->query($query));
             return array('class' => 'alert-success', 'text' => "<p>Удаление записи <b>" . $links['first_name'] . " " . $links['last_name'] . "</b> произошло успешно.</p>");
         }
     }
     return array('class' => 'alert-danger', 'text' => "<p>Запись не найдена.</p>");
 }
Example #13
0
    <meta charset="UTF-8">
    <title>Manage</title>
</head>
<body>
<form method="post" action="">
    <span><a href="index.php">Back</a> </span>
    <span><a href="action_view.php">Add new user</a> </span>
    <table border="2" width="40%">
        <thead>
        <th>Id</th>
        <th>Name</th>
        <th>Address</th>
        <th colspan="2">Action</th>
        </thead>
        <?php 
foreach ($tabl->getUsers() as $value) {
    ?>
        <tbody>
        <tr>
            <td><?php 
    echo $value['0'];
    ?>
</td>
            <td><?php 
    echo $value['1'];
    ?>
</td>
            <td><?php 
    echo $value['2'];
    ?>
</td>
Example #14
0
 public function getACData($attributeName, $query)
 {
     $users = Users::getUsers();
     $selection = array();
     $query = preg_match("/%/", $query) ? preg_replace("/%/", $query, "") : $query;
     while ($user = $users->getNextEntry()) {
         if (preg_match("/.*" . $query . ".*/", $user->A("UserEmail")) || preg_match("/.*" . $query . ".*/", $user->A("name")) || preg_match("/.*" . $query . ".*/", $user->A("username"))) {
             $subSelection = array("label" => $user->A("name"), "value" => $user->A("UserEmail"), "email" => $user->A("UserEmail"), "description" => "");
             $selection[] = $subSelection;
         }
     }
     if (Session::isPluginLoaded("mWAdresse")) {
         $adresses = new Adressen();
         $adresses->setSearchStringV3($query);
         $adresses->setSearchFieldsV3(array("firma", "nachname", "email"));
         $adresses->setFieldsV3(array("firma AS label", "AdresseID AS value", "vorname", "nachname", "CONCAT(strasse, ' ', nr, ', ', plz, ' ', ort) AS description", "email", "firma"));
         $adresses->setLimitV3("10");
         $adresses->setParser("label", "AdressenGUI::parserACLabel");
         if ($attributeName == "SendMailTo") {
             $adresses->addAssocV3("email", "!=", "");
         }
         while ($adress = $adresses->getNextEntry()) {
             $subSelection = array();
             foreach ($adress->getA() as $key => $value) {
                 $subSelection[$key] = $value;
             }
             $selection[] = $subSelection;
         }
     }
     echo json_encode($selection);
 }
require_once "header.php";
$failedGoTo = "home.php";
$successGoTo = "users.php";
$logoutGoTo = "home.php";
$access = new Access();
$logonUser = $access->isInitAccess();
if ($logonUser) {
    $typeUser = $access->isAdminUser();
}
$access->processLogout($logoutGoTo);
$access->processLogonRestriction($failedGoTo);
$access->processSendAccess($successGoTo, $failedGoTo);
unset($access);
$usersArray = array();
$users = new Users();
$usersArray = $users->getUsers();
$users->processAddUser($successGoTo, $failedGoTo);
$users->processModifyUser($successGoTo, $failedGoTo);
$users->processRemoveUser($successGoTo, $failedGoTo);
unset($users);
if ($typeUser != 1) {
    header("Location: " . "home.php");
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/Main.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>CIP (Collector and Injection Panel)</title>
Example #16
0
 public function send_order_delivery_email($message, $subject, $attach_file = null)
 {
     $cc_email = '';
     // echo 'test'; exit;
     $facility_code = $this->session->userdata('facility_id');
     $data = Users::getUsers($facility_code)->toArray();
     $cc_email .= $this->get_facility_email($facility_code);
     $cc_email .= $this->get_county_email($data[0]['district']);
     return $this->send_email(substr($this->get_ddp_email($data[0]['district']), 0, -1), $message, $subject, null, null, substr($cc_email, 0, -1));
 }
 function actionTree()
 {
     global $user;
     $tmpl = Request::getVar('tmpl', null);
     $modelUser = new Users();
     $modelGroup = new Group();
     $this->addBarTitle("Users <small>[tree]</small>", "user");
     $groupID = Request::getVar('groupID', $user->groupID);
     $group = $modelGroup->getItem($user->groupID);
     if ($group->parentID != 1) {
         if (!$user->groupChecking($groupID)) {
             $group = $modelGroup->getItem($user->groupID);
             YiiMessage::raseNotice("Your account not have permission to visit page");
             $this->redirect(Router::buildLink("cpanel"));
         }
     }
     $group = $modelGroup->getItem($groupID);
     $list_user = $modelUser->getUsers($groupID, " leader DESC, id ASC ");
     $arr_group = $modelUser->getGroups($groupID);
     if ($tmpl == null) {
         $this->render('tree', array("objGroup" => $group, "list_user" => $list_user, 'arr_group' => $arr_group));
     } else {
         if ($tmpl == 'app') {
             $this->render('treegroup', array("objGroup" => $group, "list_user" => $list_user, 'arr_group' => $arr_group));
             die;
         }
     }
 }
Example #18
0
 function showEditSettingsLanguage($message = "")
 {
     //echo 'ghghghgh' . $survey->getChangeLanguage(getSurveyMode()) . '====';
     $survey = new Survey($_SESSION['SUID']);
     $returnStr = $this->showSettingsHeader($survey, Language::headerEditSettingsLanguage());
     $returnStr .= $this->getSurveyTopTab($_SESSION['VRFILTERMODE_SURVEY']);
     $returnStr .= '<div class="well" style="background-color:white;">';
     $returnStr .= $message;
     $returnStr .= '<form id="editform" method="post">';
     $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.survey.editsettingslanguageres'));
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLanguageGeneral() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= $this->displayComboBox();
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelSettingsLanguageDefault() . "</td>";
     $returnStr .= "<td>" . $this->displayLanguagesAdmin(SETTING_DEFAULT_LANGUAGE, SETTING_DEFAULT_LANGUAGE, $survey->getDefaultLanguage(getSurveyMode()), true, false, false, "", $survey->getAllowedLanguages(getSurveyMode())) . "</td>";
     $returnStr .= "<tr><td>" . Language::labelSettingsLanguageAllowed() . "</td>";
     $returnStr .= "<td>" . $this->displayLanguagesAdmin(SETTING_ALLOWED_LANGUAGES, SETTING_ALLOWED_LANGUAGES, $survey->getAllowedLanguages(getSurveyMode()), true, false, false, "multiple") . "</td>";
     $returnStr .= "<tr><td>" . Language::labelSettingsLanguageChange() . "</td>";
     $returnStr .= "<td>" . $this->displayLanguagesChange($survey->getChangeLanguage(getSurveyMode())) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelSettingsLanguageReentry() . "</td>";
     $returnStr .= "<td>" . $this->displayLanguageReentry($survey->getReentryLanguage(getSurveyMode())) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelSettingsLanguageBack() . "</td>";
     $returnStr .= "<td>" . $this->displayLanguageBack($survey->getBackLanguage(getSurveyMode())) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelSettingsLanguageAdd() . "</td>";
     $users = new Users();
     $returnStr .= "<td>" . $this->displayUsersUpdate($users->getUsers()) . "</td></tr>";
     $returnStr .= "</table>";
     $returnStr .= '</div>';
     $returnStr .= '<input type="submit" class="btn btn-default" value="' . Language::buttonSave() . '"/>';
     $returnStr .= "</form></div>";
     $returnStr .= $this->showSettingsFooter($survey);
     return $returnStr;
 }
 public function send_order_delivery_email($message, $subject, $attach_file = null)
 {
     $cc_email = '';
     $bcc_email = 'kelvinmwas@gmail.com,smutheu@clintonhealthaccess.org,collinsojenge@gmail.com,tngugi@clintonhealthaccess.org';
     $facility_code = $this->session->userdata('facility_id');
     $data = Users::getUsers($facility_code)->toArray();
     $cc_email .= $this->get_facility_email($facility_code);
     $cc_email .= $this->get_county_email($data[0]['district']);
     return $this->send_email(substr($this->get_ddp_email($data[0]['district']), 0, -1), $message, $subject, null, $bcc_email, substr($cc_email, 0, -1));
 }
Example #20
0
function renderUsers($type = '', $users = '', $group_selection = '', $group_type = '', $show_title = FALSE)
{
    //If no Users dataset is passed on, retrieve them based on the other arguments
    if (!$users) {
        $users = Users::getUsers($type, $group_type, $group_selection);
        if (!($users && $users->rowCount())) {
            $users = null;
        }
    }
    $group_type = $group_type ? t_type($group_type) : t('environment');
    $type_nice = str_replace('_', ' ', $type);
    $empty_message = $group_selection ? tt('There is no %1$s yet in this %2$s', t($type_nice), $group_type) : tt('There are no %1$s yet.', t($type_nice));
    return formatUsersNice($users, $type, $empty_message, $show_title);
}
echo $metaRequest->getMetaData('PersistedData');
// PARSE
$r = $docRequest->getDocIndexFields('3c7168e7-4b82-e511-bf04-008cfa482110');
$s = $docRequest->getDocIndexFieldsId('3c7168e7-4b82-e511-bf04-008cfa482110', '6684bdbe-4f82-e511-bf04-008cfa482110');
echo $parseRequest->parseResponse($r, 'label');
$a = $parseRequest->parseListResponse($r, 'label', '5');
// PERSISTED DATA
echo $pdataRequest->deletePdata('7832c856-7467-4356-a56e-968f9db56f48');
echo $pdataRequest->getPdata();
echo $pdataRequest->getPdataId('17bd31bb-6cd6-43b0-be65-55e2002d91a6');
echo $pdataRequest->postPdata('phpPDATA4', 1, "{\"DataField2\":\"claro que si\",\"DataField4\":\"oh no no no\"}", 'text/JSON', '', 0, null);
echo $pdataRequest->postFormPdata('9d4d2408-1183-e511-bf05-9c4e36b08790', 'c054e3bb-bd4c-4185-8d45-cf062d369a66', '6ccf5264-4f8d-e511-bf05-9c4e36b08790');
// SITES
echo $sitesRequest->getSites();
echo $sitesRequest->getSitesId('2e2fbf9c-1079-e511-bf01-a1bb68598c42');
echo $sitesRequest->getSitesGroups('2e2fbf9c-1079-e511-bf01-a1bb68598c42');
echo $sitesRequest->getSitesGroupsId('2e2fbf9c-1079-e511-bf01-a1bb68598c42', 'b9a66abf-2b83-e511-bf05-9c4e36b08790');
echo $sitesRequest->getSitesUsers('2e2fbf9c-1079-e511-bf01-a1bb68598c42');
echo $sitesRequest->getSitesUsersId('2e2fbf9c-1079-e511-bf01-a1bb68598c42', '8dd06446-1179-e511-bf01-a1bb68598c42');
echo $sitesRequest->postSites('phpFUN2', 'a new php site');
echo $sitesRequest->postSitesGroups('4d35d7ea-e383-e511-bf05-9c4e36b08790', 'phpFUN2 Group', 'a description');
echo $sitesRequest->postSitesUsers('4d35d7ea-e383-e511-bf05-9c4e36b08790', 'phpUser3', 'php', 'Name', '*****@*****.**', 'password');
echo $sitesRequest->putSites('4d35d7ea-e383-e511-bf05-9c4e36b08790', 'new Php Name 2', 'new description');
echo $sitesRequest->putSitesGroups('4d35d7ea-e383-e511-bf05-9c4e36b08790', '6aadfd0e-e483-e511-bf05-9c4e36b08790', 'new Php Group 3', 'new description 3');
echo $sitesRequest->putSitesUsers('4d35d7ea-e383-e511-bf05-9c4e36b08790', 'd998fc72-e583-e511-bf05-9c4e36b08790', 'new php 3', 'new Name 3', '*****@*****.**');
// USERS
echo $usersRequest->getUsers();
echo $usersRequest->getUsersId('5eefec33-ca71-e511-befe-98991b71acc0');
echo $usersRequest->getUsersToken('5eefec33-ca71-e511-befe-98991b71acc0');
echo $usersRequest->postUsers('4d35d7ea-e383-e511-bf05-9c4e36b08790', 'userUser2', 'first', 'last', '*****@*****.**', 'pass');
echo $usersRequest->putUsers('7eb29bd0-ef83-e511-bf05-9c4e36b08790', 'new first 2', 'new last', '*****@*****.**');
Example #22
0
 public static function getParticipant($id = '')
 {
     return Users::getUsers('', '', '', $id)->fetchObject();
 }
Example #23
0
function showInstituteOverviewPage($institute)
{
    include_once _VALS_SOC_ROOT . '/includes/classes/Proposal.php';
    include_once _VALS_SOC_ROOT . '/includes/classes/Organisations.php';
    include_once _VALS_SOC_ROOT . '/includes/classes/Project.php';
    echo "<h2>" . t('Overview of your institute activity') . "</h2>";
    $inst_id = $institute->inst_id;
    $nr_proposals_draft = count(Proposal::getProposalsPerOrganisation('', $inst_id));
    $nr_proposals_final = count(Proposal::getProposalsPerOrganisation('', $inst_id, 'published'));
    $nr_students = Users::getUsers(_STUDENT_TYPE, _INSTITUTE_GROUP, $inst_id)->rowCount();
    $nr_groups = Groups::getGroups(_STUDENT_GROUP, 'all', $inst_id)->rowCount();
    $nr_tutors = Users::getUsers(_SUPERVISOR_TYPE, _INSTITUTE_GROUP, $inst_id)->rowCount() + Users::getUsers(_INSTADMIN_TYPE, _INSTITUTE_GROUP, $inst_id)->rowCount();
    $nr_orgs = count(Organisations::getInstance()->getOrganisations());
    $nr_projects = count(Project::getProjects());
    echo "<b>" . t("Proposals in draft:") . "</b>&nbsp; {$nr_proposals_draft}<br>";
    echo "<b>" . t("Proposals submitted:") . "</b>&nbsp; {$nr_proposals_final}<br>";
    echo "<b>" . t("Number of students subscribed:") . "</b>&nbsp; {$nr_students}<br>";
    echo "<b>" . t("Number of groups available:") . "</b>&nbsp; {$nr_groups}<br>";
    echo "<b>" . t("Number of supervisors subscribed:") . "</b>&nbsp; {$nr_tutors}<br>";
    echo "<b>" . t("Number of organisations:") . "</b>&nbsp; {$nr_orgs}<br>";
    echo "<b>" . t("Number of projects:") . "</b>&nbsp; {$nr_projects}<br>";
}
Example #24
0
 function getHTML($id)
 {
     // <editor-fold defaultstate="collapsed" desc="Aspect:jP">
     try {
         $MArgs = func_get_args();
         return Aspect::joinPoint("around", $this, __METHOD__, $MArgs);
     } catch (AOPNoAdviceException $e) {
     }
     Aspect::joinPoint("before", $this, __METHOD__, $MArgs);
     // </editor-fold>
     $this->loadMeOrEmpty();
     $bps = $this->getMyBPSData();
     $allowed = array();
     $ACS = anyC::get("Userdata", "name", "shareCalendarTo" . Session::currentUser()->getID());
     $ACS->addAssocV3("name", "=", "shareCalendarTo0", "OR");
     while ($Share = $ACS->getNextEntry()) {
         $allowed[$Share->A("UserID")] = $Share->A("wert");
     }
     if ($id == -1) {
         $this->A->TodoTillDay = Util::CLDateParser(time() + 7 * 24 * 3600);
         $this->A->TodoTillTime = Util::CLTimeParser(10 * 3600);
         $this->A->TodoFromDay = Util::CLDateParser(time() + 7 * 24 * 3600);
         $this->A->TodoFromTime = Util::CLTimeParser(9 * 3600);
         $this->A->TodoType = "2";
         if ($bps != -1 and isset($bps["TodoTillDay"])) {
             $this->A->TodoTillDay = $bps["TodoTillDay"];
             $this->A->TodoFromDay = $bps["TodoTillDay"];
             BPS::unsetProperty("TodoGUI", "TodoTillDay");
         }
         if ($bps != -1 and isset($bps["TodoFromTime"])) {
             $this->A->TodoFromTime = Util::CLTimeParser($bps["TodoFromTime"] * 3600);
             $this->A->TodoTillTime = Util::CLTimeParser(($bps["TodoFromTime"] + 1) * 3600);
             BPS::unsetProperty("TodoGUI", "TodoFromTime");
         }
         if ($bps != -1 and isset($bps["TodoDescription"])) {
             $this->A->TodoDescription = $bps["TodoDescription"];
             BPS::unsetProperty("TodoGUI", "TodoDescription");
         }
         if ($bps != -1 and isset($bps["TodoLocation"])) {
             $this->A->TodoLocation = $bps["TodoLocation"];
             BPS::unsetProperty("TodoGUI", "TodoLocation");
         }
         if ($bps != -1 and isset($bps["TodoName"])) {
             $this->A->TodoName = $bps["TodoName"];
             BPS::unsetProperty("TodoGUI", "TodoName");
         }
         $for = BPS::getProperty("mKalenderGUI", "KID", Session::currentUser()->getID());
         if ($for != Session::currentUser()->getID() and strpos($allowed[$for], "create") === false) {
             $for = Session::currentUser()->getID();
         }
         $this->A->TodoUserID = $for;
         $this->A->TodoClass = BPS::getProperty("mTodoGUI", "ownerClass");
         $this->A->TodoClassID = BPS::getProperty("mTodoGUI", "ownerClassID");
     }
     $gui = $this->GUI;
     $gui->name("Termin");
     $gui->label("TodoDescription", "Details");
     $gui->label("TodoTillDay", "Ende");
     $gui->label("TodoTillTime", "Uhrzeit");
     $gui->label("TodoFromDay", "Anfang");
     $gui->label("TodoFromTime", "Uhrzeit");
     $gui->label("TodoType", "Typ");
     $gui->label("TodoUserID", "Zuständig");
     $gui->label("TodoStatus", "Status");
     $gui->label("TodoRemind", "Erinnerung");
     $gui->label("TodoName", "Betreff");
     $gui->label("TodoRepeat", "Wiederholen");
     #$gui->label("TodoRepeatInterval","Intervall");
     $gui->label("TodoClassID", "Kunde");
     $gui->label("TodoLocation", "Ort");
     $gui->label("TodoAllDay", "Ganzer Tag");
     $gui->space("TodoRemind", "Optionen");
     $gui->space("TodoFromDay", "Zeit");
     if ($this->A("TodoFromDay") == "01.01.1970" and $this->A("TodoFromTime") == "00:00") {
         $this->changeA("TodoFromDay", $this->A("TodoTillDay"));
         $this->changeA("TodoFromTime", $this->A("TodoTillTime"));
     }
     $gui->attributes(array("TodoType", "TodoClass", "TodoClassID", "TodoDescription", "TodoLocation", "TodoFromDay", "TodoTillDay", "TodoAllDay", "TodoRemind", "TodoUserID"));
     $gui->type("TodoType", "select", TodoGUI::types());
     $gui->type("TodoRemind", "select", array("-1" => "keine Erinnerung", "60" => "1 Minute vorher", "300" => "5 Minuten vorher", "600" => "10 Minuten vorher", "900" => "15 Minuten vorher", "1800" => "30 Minuten vorher", "2700" => "45 Minuten vorher", "3600" => "1 Stunde vorher"));
     $gui->type("TodoClass", "hidden");
     $gui->type("TodoDescription", "textarea");
     $gui->type("TodoAllDay", "checkbox");
     $gui->addFieldEvent("TodoAllDay", "onchange", "\$j('#TodoFromTimeDisplay').css('display', this.checked ? 'none' : 'inline'); \$j('#TodoTillTimeDisplay').css('display', this.checked ? 'none' : 'inline');");
     $gui->parser("TodoFromDay", "TodoGUI::dayFromParser");
     $gui->parser("TodoTillDay", "TodoGUI::dayTillParser");
     $ac = Users::getUsers();
     $users = array();
     while ($u = $ac->getNextEntry()) {
         if (!isset($allowed[$u->getID()]) and $u->getID() != Session::currentUser()->getID()) {
             continue;
         }
         if (isset($allowed[$u->getID()]) and strpos($allowed[$u->getID()], "create") === false) {
             continue;
         }
         $users[$u->getID()] = $u->A("name");
     }
     $ac = Users::getUsers(1);
     while ($u = $ac->getNextEntry()) {
         if (!isset($allowed[$u->getID()]) and $u->getID() != Session::currentUser()->getID()) {
             continue;
         }
         if (isset($allowed[$u->getID()]) and strpos($allowed[$u->getID()], "create") === false) {
             continue;
         }
         $users[$u->getID()] = $u->A("name");
     }
     $users["-1"] = "Alle";
     if (Session::isPluginLoaded("mWAdresse") and ($this->A("TodoClass") == "WAdresse" or $this->A("TodoClass") == "Kalender")) {
         $gui->parser("TodoClassID", "TodoGUI::parserKunde");
     } else {
         $gui->type("TodoClassID", "hidden");
     }
     $gui->type("TodoUserID", "select", $users);
     $gui->type("TodoStatus", "select", $this->getStatus());
     $gui->activateFeature("CRMEditAbove", $this);
     if ($gui instanceof CRMHTMLGUI) {
         return $gui->getEditTableHTML(4);
     }
 }
Example #25
0
 public function send_stock_decommission_email($message, $subject, $attach_file)
 {
     $facility_code = $this->session->userdata('facility_id');
     $data = Users::getUsers($facility_code)->toArray();
     $email_address = $this->get_facility_email($facility_code);
     $email_address .= $this->get_ddp_email($data[0]['district']);
     $this->send_email(substr($email_address, 0, -1), $message, $subject, $attach_file);
 }
 public function personAction($reception = null, $item_id = null)
 {
     $this->view->setVar("TopMenuSelected", 'work');
     $this->view->setVar("MenuSelected", 'persons');
     $this->view->setVar("MenuItemActive", $reception);
     $messages = array();
     if (!empty($reception)) {
         $view = $reception;
         switch ($reception) {
             case 'add':
                 $this->view->setVar("CountriesAll", References::getCountries());
                 break;
             case 'preview-cache-station':
                 if ($this->request->isPost()) {
                     if ((bool) $this->request->getPost('add')) {
                         View::addMessages($this, [References::addPersonNew($this->request->getPost('full_name'), $this->request->getPost('address'), $this->request->getPost('country_id'), 3, $this->request->getPost('code'), 1, $this->request->getPost('phone'), Users::getStationId($this))]);
                     }
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень записей Адресной книги кэшированных только для этой станции.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsCache(Users::getStationId($this)));
                 break;
             case 'preview-cache':
                 if ($this->request->isPost()) {
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень часто использующихся записей Адресной книги всех станций.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsHot());
                 break;
             case 'preview':
                 if ($this->request->isPost()) {
                     //$messages[] = Users::addUser($this->request->getPost());
                     //$messages[] = Users::deleteUser($this->request->getPost('id'));
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Полный перечень записей Адресной книги всех станций.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsAll());
                 break;
             case 'edit':
                 if (empty($item_id)) {
                     if ($this->request->isPost()) {
                         $this->response->redirect('/administration/user/edit/' . $this->request->getPost('user_id'), '/');
                     }
                     $messages[] = array('class' => 'alert-info', 'text' => "<p><b>Выберите</b> из выпадающего списка <b>профиль пользователя</b>, который нужно изменить.</p>");
                     $this->view->setVar("UsersAll", Users::getUsers());
                 } else {
                     if ($this->request->isPost()) {
                         $messages[] = Users::setUser($this->request->getPost());
                     }
                     $this->view->setVar("User", Users::getUsers($item_id));
                     $this->view->setVar("StationsAll", Stations::getStations());
                     $this->view->setVar("RolesAll", Roles::getRoles());
                     $this->view->setVar("LanguagesAll", References::getLanguages());
                     $this->view->setVar("CurrencyAll", References::getCurrency());
                     $this->view->setVar("Units1", References::getUnits(NULL, array(1))['units']);
                     $this->view->setVar("Units2", References::getUnits(NULL, array(3))['units']);
                     $this->view->setVar("Units3", References::getUnits(NULL, array(4))['units']);
                 }
                 break;
             case 'settings':
                 if ($this->request->isPost()) {
                     $messages[] = Users::addUser($this->request->getPost());
                     //$messages[] = Users::deleteUser($this->request->getPost('id'));
                 }
                 $this->view->setVar("UsersAll", Users::getUsers());
                 break;
         }
         $this->view->pick('/administration/' . "person_" . $view);
     }
     //$this->view->setVar("messages", $messages);
 }
Example #27
0
 public function saveShare()
 {
     $args = func_get_args();
     #$UD = new mUserdata();
     #$UD->getAsArray("shareCalendar");
     $i = 0;
     $US = Users::getUsers();
     while ($U = $US->getNextEntry()) {
         if ($U->getID() == Session::currentUser()->getID()) {
             continue;
         }
         if ($args[$i] != "none") {
             mUserdata::setUserdataS("shareCalendarTo" . $U->getID(), $args[$i], "shareCalendar");
         } else {
             $UD = new mUserdata();
             $UD->delUserdata("shareCalendarTo" . $U->getID());
         }
         $i++;
     }
 }
// now we pass in the response to the parseRequest method and request the folderId and store it as $b.
$b = $parseRequest->parseResponse($a, 'id');
// now we have the folderId. we can display it or pass it into another method.
// lets create a document and pass in the folderId $b.
echo $docRequest->postDoc($b, 1, 'phpParseFile', 'a test file', 'parse.txt', '{}');
// parseListResponse() (list of field values returned)
// for the parseListResponse method an array is returned.
// we write a sample function here to display the results.
function echoList($array, $itemCount)
{
    for ($i = 0; $i < $itemCount; $i++) {
        echo $array[$i] . "\n";
    }
}
// now the getUsers() method is called and the response is stored as a variable $c.
$c = $usersRequest->getUsers();
// now we pass in the response from the getUsers() call and request a list of 10 userId's
// stored as an array $d.
$d = $parseRequest->parseListResponse($c, 'name', '10');
// now we call echoList to display the users in the array returned by parseListResponse().
echoList($d, '10');
// EMBED A FORM FROM VISUALVAULT
// first method call requests and stores the users WebToken (userId is passed in here).
$userToken = $u->getUsersToken('5eefec33-ca71-e511-befe-98991b71acc0');
// now a URL is returned by the formTemplateId of the form you want returned, and the userToken
// passed in from the previous method call.
echo $f->embedForm('9d4d2408-1183-e511-bf05-9c4e36b08790', $userToken);
// EMBED A FORM WITH PERSISTED DATA FROM VISUALVAULT
// first method call requests and stores the users WebToken (userId is passed in here).
$userToken = $u->getUsersToken('5eefec33-ca71-e511-befe-98991b71acc0');
// now a URL is returned by the formTemplateId of the form you want returned, the persistedDataId