コード例 #1
0
 function removeTest($aTestData, $aFields)
 {
     $oGroupUser = new GroupUser();
     try {
         return $oGroupUser->remove($aFields['GRP_UID'], $aFields['USR_UID']);
     } catch (Exception $oError) {
         return $oError;
     }
 }
コード例 #2
0
ファイル: editoccupant.php プロジェクト: careck/bendms
function editoccupant_POST(Web $w)
{
    list($householdid, $occupantid) = $w->pathMatch("a", "b");
    if (empty($householdid)) {
        $w->out("no household id provide");
        return;
    }
    $household = $w->Bend->getHouseholdForId($householdid);
    $oc = new BendHouseholdOccupant($w);
    $user = new User($w);
    $contact = new Contact($w);
    if (!empty($occupantid)) {
        $oc = $w->Bend->getHouseholdOccupantForId($occupantid);
    }
    $oc->fill($_POST);
    $oc->bend_household_id = $householdid;
    $oc->insertOrUpdate();
    if (!empty($oc->user_id)) {
        $user = $oc->getUser();
        $contact = $user->getContact();
    }
    $contact->fill($_POST);
    $contact->insertOrUpdate();
    // create a new user if necessary
    if (empty($user->id)) {
        $user->contact_id = $contact->id;
        $user->login = $contact->email;
        $user->is_active = 1;
        $user->redirect_url = "bend";
        $user->insert();
        // assign to bend users group
        $group = $w->Auth->getUserForLogin("Bend Users");
        if (empty($group)) {
            // create the group!
            $group = new User($w);
            $group->is_group = 1;
            $group->login = "******";
            $group->insert();
        }
        $gu = new GroupUser($w);
        $gu->group_id = $group->id;
        $gu->user_id = $user->id;
        $gu->role = "member";
        $gu->insert();
        $oc->user_id = $user->id;
        $oc->update();
    }
    $w->msg("Occupant updated", "/bend-household/show/{$household->bend_lot_id}/{$householdid}");
}
コード例 #3
0
ファイル: editlotowner.php プロジェクト: careck/bendms
function editlotowner_POST(Web $w)
{
    list($lotId, $lotOwnerId) = $w->pathMatch("lotId", "lotOwnerId");
    if (empty($lotId)) {
        $w->out("no lot id provide");
        return;
    }
    $lot = $w->Bend->getLotForId($lotId);
    $lotOwner = new BendLotOwner($w);
    $user = new User($w);
    $contact = new Contact($w);
    if (!empty($lotOwnerId)) {
        $lotOwner = $w->Bend->getBendLotOwnerForId($lotOwnerId);
    }
    $lotOwner->fill($_POST);
    $lotOwner->bend_lot_id = $lotId;
    $lotOwner->insertOrUpdate();
    if ($lotOwner->user_id) {
        $user = $lotOwner->getUser();
        $contact = $user->getContact();
    }
    $contact->fill($_POST);
    $contact->insertOrUpdate();
    // create a new user if necessary
    if (empty($user->id)) {
        $user->contact_id = $contact->id;
        $user->login = $contact->email;
        $user->is_active = 1;
        $user->redirect_url = "bend";
        $user->insert();
        // assign to bend users group
        $group = $w->Auth->getUserForLogin("Bend Users");
        if (empty($group)) {
            // create the group!
            $group = new User($w);
            $group->is_group = 1;
            $group->login = "******";
            $group->insert();
        }
        $gu = new GroupUser($w);
        $gu->group_id = $group->id;
        $gu->user_id = $user->id;
        $gu->role = "member";
        $gu->insert();
        $lotOwner->user_id = $user->id;
        $lotOwner->update();
    }
    $w->msg("Lot Owner updated", "/bend-lot/showlot/{$lotId}");
}
コード例 #4
0
ファイル: GroupUser.php プロジェクト: a4501150/FDUGroup
 public static function isUserInGroup($userId, $groupId)
 {
     if (GroupUser::find(array("groupId", $groupId, "userId", $userId))->first() != null) {
         return true;
     }
     return false;
 }
コード例 #5
0
ファイル: UserController.php プロジェクト: a4501150/FDUGroup
 public function actionView($userId, $part = 'joins')
 {
     $user = User::get($userId);
     RAssert::not_null($user);
     $data = array('user' => $user, 'part' => $part);
     if (Rays::isLogin()) {
         $loginUser = Rays::user();
         $friend = new Friend();
         $friend->uid = Rays::user()->id;
         $friend->fid = $user->id;
         $data['canAdd'] = $loginUser->id != $user->id && !Friend::isFriend($loginUser->id, $userId);
         $data['canCancel'] = $loginUser->id != $user->id && !$data['canAdd'];
     }
     $page = $this->getPage("page");
     $pageSize = $this->getPageSize("pageSize", 10);
     $count = 0;
     switch ($part) {
         case 'joins':
             $pageSize = $this->getPageSize("pageSize", 5);
             $data['userGroup'] = GroupUser::getGroups(GroupUser::find("userId", $userId)->join("group")->order_desc("groupId")->range(($page - 1) * $pageSize, $pageSize));
             $count = User::countGroups($userId);
             break;
         case 'posts':
             $data['postTopics'] = Topic::find("userId", $userId)->join("group")->order_desc("id")->range(($page - 1) * $pageSize, $pageSize);
             $count = User::countPosts($userId);
             break;
         case 'likes':
             $data['likeTopics'] = RatingPlus::getUserPlusTopics($userId, ($page - 1) * $pageSize, $pageSize);
             $count = RatingPlus::countUserPostsPlus($userId);
             break;
         case 'profile':
             break;
         default:
             return;
     }
     if (Rays::isAjax()) {
         echo empty($data['userGroup']) ? 'nomore' : $this->renderPartial("_common._groups_list", ["groups" => $data['userGroup']], true);
         exit;
     }
     if ($part == "posts" || $part == "likes") {
         if ($count > $pageSize) {
             $pager = new RPager("page", $count, $pageSize, RHtml::siteUrl("user/view/" . $userId . "/" . $part), $page);
             $data['pager'] = $pager->showPager();
         }
     }
     if ($part == "joins") {
         $this->addCss('/public/css/group.css');
         $this->addJs('/public/js/masonry.pkgd.min.js');
     }
     //$this->addJs("/public/js/jquery.dotdotdot.min.js");
     $this->setHeaderTitle($user->name);
     $this->render('view', $data, false);
     // Need to be complete because the codes below will increase the counter every time this page is viewed
     $counter = new Counter();
     $counter->increaseCounter($user->id, User::ENTITY_TYPE);
 }
コード例 #6
0
ファイル: groupmember.php プロジェクト: itillawarra/cmfive
function groupmember_POST(Web $w)
{
    $p = $w->pathMatch("group_id");
    $member_id = $w->request('member_id');
    $group_id = $p['group_id'];
    $is_owner = $w->request('is_owner');
    $exceptions = array();
    // store all parent groups in session
    $groupUsers = $w->Auth->getUser($group_id)->isInGroups();
    if ($groupUsers) {
        foreach ($groupUsers as $groupUser) {
            $groupUser->getParents();
        }
    }
    // add member to the group only if it isn't already in there
    // this logic should move to the model!
    $existUser = $w->Auth->getUser($member_id)->isInGroups($group_id);
    if (!$existUser) {
        if (!$w->session('parents') || !in_array($member_id, $w->session('parents'))) {
            $groupMember = new GroupUser($w);
            $groupMember->group_id = $group_id;
            $groupMember->user_id = $member_id;
            $groupMember->role = $is_owner && $is_owner == 1 ? "owner" : "member";
            $groupMember->insert();
        }
        if ($w->session('parents') && in_array($member_id, $w->session('parents'))) {
            $exceptions[] = $w->Auth->getUser($member_id)->login;
        }
    } else {
        $user = $existUser[0]->getUser();
        $exceptions[] = $user->is_group == 1 ? $user->login : $user->getContact()->getFullName();
    }
    $w->sessionUnset('parents');
    if (!empty($exceptions)) {
        $w->error(implode(", ", $exceptions) . " can not be added!", "/admin/moreInfo/" . $group_id);
    } else {
        $w->msg("New members are added!", "/admin/moreInfo/" . $group_id);
    }
}
コード例 #7
0
ファイル: GroupUser.php プロジェクト: emildev35/processmaker
 /**
  * Create the application document registry
  *
  * @param array $aData
  * @return string
  */
 public function create($aData)
 {
     $oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
     try {
         $oGroupUser = new GroupUser();
         $oGroupUser->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oGroupUser->validate()) {
             $oConnection->begin();
             $iResult = $oGroupUser->save();
             $oConnection->commit();
             return $iResult;
         } else {
             $sMessage = '';
             $aValidationFailures = $oGroupUser->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
コード例 #8
0
ファイル: Friend.php プロジェクト: a4501150/FDUGroup
 public function getFriendsToInvite($uid, $groupId, $start = 0, $limit = 0)
 {
     $groupUsers = GroupUser::find("groupId", $groupId)->all();
     $result = Friend::find("uid", $uid)->join("user");
     if ($groupUsers != null && !empty($groupUsers)) {
         $where = "[fid] not in(";
         $args = [];
         for ($count = count($groupUsers), $i = 0; $i < $count; $i++) {
             $where .= "?" . ($i < $count - 1 ? "," : "");
             $args[] = $groupUsers[$i]->userId;
         }
         unset($groupUsers);
         $where .= ")";
         $result = $result->where($where, $args);
     }
     return $limit != 0 || $start != 0 ? $result->range($start, $limit) : $result->all();
 }
コード例 #9
0
ファイル: PostController.php プロジェクト: a4501150/FDUGroup
 public function actionEdit($topicId)
 {
     $topic = Topic::get($topicId);
     if (Rays::isPost()) {
         $validation = new RValidation(array(array("field" => "title", "label" => "Title", "rules" => "trim|required"), array("field" => "post-content", "label" => "Content", "rules" => "trim|required")));
         $topic->title = $_POST['title'];
         $topic->content = RHtml::encode($_POST['post-content']);
         if ($validation->run()) {
             $topic->save();
             $this->flash("message", "Post " . $topic->title . " was updated successfully.");
             $this->redirectAction('post', 'view', $topic->id);
         } else {
             $data['validation_errors'] = $validation->getErrors();
         }
     }
     $group = Group::get($topic->groupId);
     $data = array("type" => "edit", "topic" => $topic, 'group' => $group, 'groupId' => $group->id);
     $data['groups'] = GroupUser::getGroups(GroupUser::find("userId", Rays::user()->id)->join("group")->order_desc("groupId")->all());
     $this->layout = 'user';
     $this->addCss('/public/css/post.css');
     $this->setHeaderTitle("Edit post: " . $topic->title);
     $this->render('edit', $data, false);
 }
コード例 #10
0
ファイル: MembersAction.php プロジェクト: a4501150/FDUGroup
 public function run()
 {
     $params = $this->getParams();
     $groupId = $params[0];
     if (!is_numeric($groupId)) {
         $this->getController()->page404();
         return;
     }
     if (($group = Group::get($groupId)) !== null) {
         if (Rays::isPost()) {
             // remove members request
             if (isset($_POST['selected_members'])) {
                 $ids = $_POST['selected_members'];
                 if (is_array($ids)) {
                     $flag = true;
                     foreach ($ids as $id) {
                         if (!is_numeric($id) || $id == $group->creator) {
                             $flag = false;
                             break;
                         }
                     }
                     if ($flag) {
                         GroupUser::removeUsers($groupId, $ids);
                     }
                 }
             }
         }
         $group->category = Category::get($group->categoryId);
         $members = Group::getMembers($group->id);
         $this->getController()->setHeaderTitle("Members in " . $group->name);
         $this->getController()->render('members', array('members' => $members, 'manager' => User::get($group->creator), 'group' => $group, 'memberCount' => count($members), 'topicCount' => Group::countTopics($groupId)), false);
     } else {
         $this->getController()->page404();
         return;
     }
 }
コード例 #11
0
 /**
  * Validates all modified columns of given GroupUser object.
  * If parameter $columns is either a single column name or an array of column names
  * than only those columns are validated.
  *
  * NOTICE: This does not apply to primary or foreign keys for now.
  *
  * @param      GroupUser $obj The object to validate.
  * @param      mixed $cols Column name or array of column names.
  *
  * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
  */
 public static function doValidate(GroupUser $obj, $cols = null)
 {
     $columns = array();
     if ($cols) {
         $dbMap = Propel::getDatabaseMap(GroupUserPeer::DATABASE_NAME);
         $tableMap = $dbMap->getTable(GroupUserPeer::TABLE_NAME);
         if (!is_array($cols)) {
             $cols = array($cols);
         }
         foreach ($cols as $colName) {
             if ($tableMap->containsColumn($colName)) {
                 $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                 $columns[$colName] = $obj->{$get}();
             }
         }
     } else {
         if ($obj->isNew() || $obj->isColumnModified(GroupUserPeer::GRP_UID)) {
             $columns[GroupUserPeer::GRP_UID] = $obj->getGrpUid();
         }
         if ($obj->isNew() || $obj->isColumnModified(GroupUserPeer::USR_UID)) {
             $columns[GroupUserPeer::USR_UID] = $obj->getUsrUid();
         }
     }
     return BasePeer::doValidate(GroupUserPeer::DATABASE_NAME, GroupUserPeer::TABLE_NAME, $columns);
 }
コード例 #12
0
ファイル: groups_Ajax.php プロジェクト: ralpheav/processmaker
 require_once 'classes/model/GroupUser.php';
 G::LoadClass('configuration');
 $co = new Configurations();
 $config = $co->getConfiguration('groupList', 'pageSize', '', $_SESSION['USER_LOGGED']);
 $env = $co->getConfiguration('ENVIRONMENT_SETTINGS', '');
 $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
 $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
 $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
 $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
 global $RBAC;
 if ($limit == $start) {
     $limit = $limit + $limit;
 }
 $tasks = new TaskUser();
 $aTask = $tasks->getCountAllTaksByGroups();
 $members = new GroupUser();
 $aMembers = $members->getCountAllUsersByGroup();
 require_once PATH_CONTROLLERS . 'adminProxy.php';
 $uxList = adminProxy::getUxTypesList();
 $groups = new Groupwf();
 $data = $groups->getAllGroup($start, $limit, $filter);
 $result = $data['rows'];
 $totalRows = 0;
 $arrData = array();
 foreach ($result as $results) {
     $totalRows++;
     $results['CON_VALUE'] = str_replace(array("<", ">"), array("&lt;", "&gt;"), $results['GRP_TITLE']);
     $results['GRP_TASKS'] = isset($aTask[$results['GRP_UID']]) ? $aTask[$results['GRP_UID']] : 0;
     $results['GRP_USERS'] = isset($aMembers[$results['GRP_UID']]) ? $aMembers[$results['GRP_UID']] : 0;
     $arrData[] = $results;
 }
コード例 #13
0
 /**
  * Edit group
  *
  * @param void
  * @return null
  */
 function edit_group()
 {
     $this->setTemplate('add_group');
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $group = Groups::findById(get_id());
     if (!$group instanceof Group) {
         flash_error(lang('group dnx'));
         $this->redirectTo('administration', 'groups');
     }
     // if
     if (logged_user()->isAdministrator()) {
         $projects = Projects::getAll();
     } else {
         $projects = null;
     }
     $permissions = ProjectUsers::getNameTextArray();
     $group_data = array_var($_POST, 'group');
     if (!is_array($group_data)) {
         $group_data = array('name' => $group->getName(), 'can_edit_company_data' => $group->getCanEditCompanyData(), 'can_manage_security' => $group->getCanManageSecurity(), 'can_manage_workspaces' => $group->getCanManageWorkspaces(), 'can_manage_configuration' => $group->getCanManageConfiguration(), 'can_manage_contacts' => $group->getCanManageContacts(), 'can_manage_templates' => $group->getCanManageTemplates(), 'can_manage_reports' => $group->getCanManageReports(), 'can_manage_time' => $group->getCanManageTime(), 'can_add_mail_accounts' => $group->getCanAddMailAccounts());
         // array
     }
     // if
     $users = GroupUsers::getUsersByGroup($group->getId());
     if ($users) {
         foreach ($users as $usr) {
             $group_data['user[' . $usr->getId() . ']'] = true;
         }
     }
     tpl_assign('group', $group);
     tpl_assign('group_data', $group_data);
     tpl_assign('permissions', $permissions);
     tpl_assign('projects', $projects);
     if (is_array(array_var($_POST, 'group'))) {
         $group->setFromAttributes($group_data);
         if (array_var($group_data, "can_edit_company_data") != 'checked') {
             $group->setCanEditCompanyData(false);
         }
         if (array_var($group_data, "can_manage_security") != 'checked') {
             $group->setCanManageSecurity(false);
         }
         if (array_var($group_data, "can_manage_configuration") != 'checked') {
             $group->setCanManageConfiguration(false);
         }
         if (array_var($group_data, "can_manage_workspaces") != 'checked') {
             $group->setCanManageWorkspaces(false);
         }
         if (array_var($group_data, "can_manage_contacts") != 'checked') {
             $group->setCanManageContacts(false);
         }
         if (array_var($group_data, "can_manage_templates") != 'checked') {
             $group->setCanManageTemplates(false);
         }
         if (array_var($group_data, "can_manage_reports") != 'checked') {
             $group->setCanManageReports(false);
         }
         if (array_var($group_data, "can_manage_time") != 'checked') {
             $group->setCanManageTime(false);
         }
         if (array_var($group_data, "can_add_mail_accounts") != 'checked') {
             $group->setCanAddMailAccounts(false);
         }
         try {
             DB::beginWork();
             //set permissions
             $permissionsString = array_var($_POST, 'permissions');
             if ($permissionsString && $permissionsString != '') {
                 $permissions = json_decode($permissionsString);
             }
             if (is_array($permissions) && count($permissions) > 0) {
                 //Clear old modified permissions
                 $ids = array();
                 foreach ($permissions as $perm) {
                     $ids[] = $perm->wsid;
                 }
                 ProjectUsers::clearByUser($group, implode(',', $ids));
                 //Add new permissions
                 //TODO - Make batch update of these permissions
                 foreach ($permissions as $perm) {
                     if (ProjectUser::hasAnyPermissions($perm->pr, $perm->pc)) {
                         $relation = new ProjectUser();
                         $relation->setProjectId($perm->wsid);
                         $relation->setUserId($group->getId());
                         $relation->setCheckboxPermissions($perm->pc);
                         $relation->setRadioPermissions($perm->pr);
                         $relation->save();
                     }
                     //endif
                     //else if the user has no permissions at all, he is not a project_user. ProjectUser is not created
                 }
                 //end foreach
             }
             // if
             $group->save();
             GroupUsers::clearByGroup($group);
             if (array_var($_POST, 'user')) {
                 foreach (array_var($_POST, 'user') as $user_id => $val) {
                     if ($val == 'checked' && is_numeric($user_id) && Users::findById($user_id) instanceof User) {
                         $gu = new GroupUser();
                         $gu->setGroupId($group->getId());
                         $gu->setUserId($user_id);
                         $gu->save();
                     }
                 }
             }
             ApplicationLogs::createLog($group, null, ApplicationLogs::ACTION_EDIT);
             DB::commit();
             flash_success(lang('success edit group', $group->getName()));
             ajx_current("back");
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
         }
         // try
     }
     // if
 }
コード例 #14
0
ファイル: filtermates.php プロジェクト: NemOry/Skoolyf
        } else {
            if ($filterby == "clubmates") {
                $orgbyuser = ClubUser::getClubsImIn($thestudent->id);
                $ids = array();
                foreach ($orgbyuser as $item) {
                    array_push($ids, $item->clubid);
                }
                $mates = ClubUser::getUsersInMultipleClubsSearch($ids, $_GET['input']);
            } else {
                if ($filterby == "groupmates") {
                    $orgbyuser = GroupUser::getGroupsImIn($thestudent->id);
                    $ids = array();
                    foreach ($orgbyuser as $item) {
                        array_push($ids, $item->groupid);
                    }
                    $mates = GroupUser::getUsersInMultipleGroupsSearch($ids, $_GET['input']);
                }
            }
        }
    }
}
if (count($mates) > 0) {
    foreach ($mates as $mate) {
        $usermate = User::get_by_id($mate->userid);
        if (!$usermate) {
            continue;
        }
        if ($session->is_logged_in()) {
            if ($thestudent->id == $usermate->id || $session->user_id == $usermate->id) {
                continue;
            }
コード例 #15
0
ファイル: class.AppSolr.php プロジェクト: nshong/processmaker
 /**
  * Get the user groups
  * @param string $usrUID the user identifier 
  * @return array of user groups
  */
 public function getUserGroups($usrUID)
 {
     $gu = new GroupUser();
     $rows = $gu->getAllUserGroups($usrUID);
     return $rows;
 }
コード例 #16
0
ファイル: create.php プロジェクト: NemOry/Skoolyf
     $object = new Group();
     $object->schoolid = $school->id;
     $object->name = $_POST['name'];
     $object->about = $_POST['about'];
     $object->fbcomments = $_POST['fbcomments'];
     $object->comments = $_POST['comments'];
     $file = new File($_FILES['logo']);
     if ($file->valid) {
         $object->logo = $file->data;
     }
     $file = new File($_FILES['cover']);
     if ($file->valid) {
         $object->cover = $file->data;
     }
     $object->create();
     $groupuser = new GroupUser();
     $groupuser->groupid = $object->id;
     $groupuser->userid = $session->user_id;
     $groupuser->level = 1;
     $groupuser->role = "admin";
     $groupuser->enabled = 1;
     $groupuser->pending = 0;
     $groupuser->create();
     $log = new Log($session->user_id, $clientip, "WEB", "CREATED GROUP: " . $object->id);
     $log->create();
     $message = "success";
 } else {
     $log = new Log($session->user_id, $clientip, "WEB", "CREATE GROUP NOT FILLED");
     $log->create();
     $message = "All fields are required.";
 }
コード例 #17
0
 public function fetchPostByID()
 {
     $user = Auth::user();
     $input = Input::all();
     // search for post by ID
     //$searchForPost = DB::table('posts')->where('id', $input['postid'])->get();
     $post = Post::where('id', $input['postid'])->take(1)->get();
     //$jsonOut = json_decode($searchForPost[0]->status);
     $post->status = $post[0]->filterStatus();
     $post->image = ($post[0]->statustype = 'image') ? $post[0]->displayMediaApi() : '';
     //////////
     if ($post->image != '') {
         $doc = new DOMDocument();
         $doc->loadHTML($post->image);
         $xpath = new DOMXPath($doc);
         $src = $xpath->evaluate("string(//img/@src)");
         $post->image = $src;
     }
     /////////
     //$post->mission_completed = true;
     //print_r();
     // set display mission
     if ($post[0]->display_mission == 1) {
         $post->display_mission = true;
     }
     // get the groupid
     $groupid = GroupUser::where('user_id', '=', $user['id'])->pluck('group_id');
     // get the taskid
     $taskid = $post[0]->task_id;
     // get the outcome id
     $group = Group::find($groupid);
     $outcomeid = Outcome::find($group->outcome)->id;
     // execute query
     $userTaskArray = DB::table('user_tasks')->where('outcome_id', $outcomeid)->where('user_id', $user['id'])->where('group_id', $groupid)->where('task_id', $taskid)->where('complete', 1)->get();
     //print_r(count($userTaskArray));
     if (count($userTaskArray) > 0) {
         $post->mission_completed = true;
         $post->general = false;
     } else {
         $post->mission_completed = false;
         $post->general = true;
     }
     return json_encode($post);
 }
コード例 #18
0
ファイル: getstudentsgrid2.php プロジェクト: NemOry/Skoolyf
 echo '  </div>';
 echo '  <div class="span12 thebox">';
 echo '      <p class="ybname2">Adviser Message</p>';
 echo '      <p class="advisermessage">';
 echo '        ' . $section->advisermessage . '';
 echo '      </p>';
 echo '  </div>';
 $sectionusers = SectionUser::getUsersInSection($section->id);
 foreach ($sectionusers as $sectionuser) {
     $counter++;
     $filename = $counter;
     if ($sectionuser->pending == 0 && $sectionuser->enabled == 1) {
         $user = User::get_by_id($sectionuser->userid);
         $achievements = Achievement::get($user->id, "user", $batch->id);
         $clubusers = ClubUser::getClubsImIn($user->id);
         $groupusers = GroupUser::getGroupsImIn($user->id);
         $comments = Comment::get_all_comments($user->id, "user");
         if ($user->pending == 0 && $user->enabled == 1) {
             echo '<div class="span12"></div>';
             echo '  <div class="span12 mygridbox">';
             echo '    <div class="span4">';
             file_put_contents($path . "images/" . $filename . "xx.jpg", base64_decode($user->picture));
             echo '  <img class="img-polaroid img-circle yearbookimage ybimage" src="http://skoolyf.kellyescape.com/' . $path . 'images/' . $filename . 'xx.jpg" />';
             //echo '      <img class="img-polaroid img-circle yearbookimage ybimage" src="data:image/jpeg;base64, '.$user->picture.'"/>';
             echo '    </div>';
             echo '    <div class="span8">';
             echo '      <p class="ybname">' . $user->get_full_name() . '</p>';
             echo '      <p class="ybmotto">';
             echo '        ' . $user->moto . '';
             echo '      </p>';
             echo '      <p class="ybmotto">';
コード例 #19
0
ファイル: GroupController.php プロジェクト: a4501150/FDUGroup
 public function actionExit($groupId = null)
 {
     $groupUser = GroupUser::find(array("groupId", $groupId, "userId", Rays::user()->id))->first();
     $group = Group::get($groupId);
     if ($group == null) {
         $this->flash("error", "You are not the member of the group!");
     } else {
         if ($group->creator == $groupUser->userId) {
             // group creator cannot exit the group
             $this->flash("error", "You cannot exit group " . RHtml::linkAction('group', $group->name, 'detail', $group->id) . " , because you're the group creator!");
         } else {
             $groupUser->delete();
             $group->memberCount--;
             $group->save();
             $this->flash("message", "You have exited the group successfully.");
         }
     }
     $this->redirectAction('group', 'mygroups', Rays::user()->id);
 }
コード例 #20
0
ファイル: User.class.php プロジェクト: pnagaraju25/fengoffice
 function setAsAdministrator($setAsAdmin = true)
 {
     if (!logged_user() instanceof User || can_manage_security(logged_user())) {
         if ($setAsAdmin && !$this->isAdministrator()) {
             $group_user = new GroupUser();
             $group_user->setUserId($this->getId());
             $group_user->setGroupId(Group::CONST_ADMIN_GROUP_ID);
             $group_user->save();
         }
         if (!$setAsAdmin && $this->getId() != 1 && $this->isAdministrator()) {
             GroupUsers::delete('user_id = ' . $this->getId() . ' and group_id = ' . Group::CONST_ADMIN_GROUP_ID);
         }
     }
 }
コード例 #21
0
 /**
  * New feature - User Experience Redirector
  *
  * @author Erik Amaru Ortiz <*****@*****.**>
  */
 public function _getUXLocation()
 {
     require_once 'classes/model/Users.php';
     $u = UsersPeer::retrieveByPK($this->usrID);
     $url = '';
     $uxType = $u->getUsrUx();
     $_SESSION['user_experience'] = 'NORMAL';
     // find a group setting
     if ($uxType == '' || $uxType == 'NORMAL') {
         require_once 'classes/model/GroupUser.php';
         $gu = new GroupUser();
         $ugList = $gu->getAllUserGroups($this->usrID);
         foreach ($ugList as $row) {
             if ($row['GRP_UX'] != 'NORMAL' && $row['GRP_UX'] != '') {
                 $uxType = $row['GRP_UX'];
                 break;
             }
         }
     }
     switch ($uxType) {
         case 'SIMPLIFIED':
         case 'SWITCHABLE':
         case 'SINGLE':
             $_SESSION['user_experience'] = $uxType;
             $_SESSION['user_last_skin'] = SYS_SKIN;
             $url = '/sys' . SYS_SYS . '/' . $this->lang . '/uxs/' . 'home';
             break;
     }
     return $url;
 }
コード例 #22
0
ファイル: filterstudents.php プロジェクト: NemOry/Skoolyf
             if (isset($_GET['clubid'])) {
                 $club = Club::get_by_id($_GET['clubid']);
                 $theuser = ClubUser::getUser($object->id, $club->id);
                 if ($theuser) {
                     if ($theuser->pending == 1) {
                         $html .= '  <td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>';
                     } else {
                         $html .= '<td><button class="btn-small button-flat-action disabled">Member</button></td>';
                     }
                 } else {
                     $html .= '<td><button class="btn-small button-flat-primary btninvite">Invite<span hidden>' . $object->id . '</span></button></td>';
                 }
             } else {
                 if (isset($_GET['groupid'])) {
                     $group = Group::get_by_id($_GET['groupid']);
                     $theuser = GroupUser::getUser($object->id, $group->id);
                     if ($theuser) {
                         if ($theuser->pending == 1) {
                             $html .= '  <td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>';
                         } else {
                             $html .= '<td><button class="btn-small button-flat-action disabled">Member</button></td>';
                         }
                     } else {
                         $html .= '<td><button class="btn-small button-flat-primary btninvite">Invite<span hidden>' . $object->id . '</span></button></td>';
                     }
                 }
             }
         }
     }
 }
 $html .= '</tr>';
コード例 #23
0
ファイル: multi_delete.php プロジェクト: NemOry/Skoolyf
require_once "../../includes/initialize.php";
$what = $_POST['what'];
$ids = $_POST['ids'];
$response = "error";
global $session;
if (!$session->is_logged_in()) {
    die("not logged in");
}
if ($what == "user") {
    foreach ($ids as $id) {
        SchoolUser::delete_all_by_userid($id);
        BatchUser::delete_all_by_userid($id);
        SectionUser::delete_all_by_userid($id);
        ClubUser::delete_all_by_userid($id);
        GroupUser::delete_all_by_userid($id);
        User::get_by_id($id)->delete();
    }
    $log = new Log($session->user_id, $clientip, "WEB", "DELETED MULTIPLE USERS");
    $log->create();
    $response = "success";
} else {
    if ($what == "school") {
        foreach ($ids as $id) {
            $school = School::get_by_id($id);
            $folder_path = "../../public/schools/" . $school->id;
            if (file_exists($folder_path) && $folder_path != "../../public/schools/") {
                rrmdir($folder_path);
            }
            //===================SECTION=============================//
            SectionUser::delete_all_by_schoolid($school->id);
コード例 #24
0
ファイル: _groups_list.php プロジェクト: a4501150/FDUGroup
                <a href="javascript:void(0);" title="Members of this group">
                    <span class="glyphicon glyphicon-user"></span> <?php 
    echo $group->memberCount;
    ?>
                </a>
            </div>

            <div class="action action-like">
                <?php 
    $self->module('rating_plus', array('id' => 'rating_plus', 'entityType' => Group::ENTITY_TYPE, 'entityId' => $group->id));
    ?>
            </div>

            <?php 
    if (Rays::isLogin()) {
        if (!GroupUser::isUserInGroup(Rays::user()->id, $group->id)) {
            ?>
                    <div class="action action-right">
                        <?php 
            $url = RHtml::siteUrl('group/join');
            ?>
                        <a href="javascript: joinGroup('<?php 
            echo $url;
            ?>
','<?php 
            echo $group->id;
            ?>
')" title="Join the group"><span class="glyphicon glyphicon-plus"></span></a>
                    </div>
                <?php 
        }
コード例 #25
0
ファイル: accept.php プロジェクト: NemOry/Skoolyf
                 $object->pending = 0;
                 $object->update();
                 $notification->title = "message";
                 $notification->itemid = $itemid;
                 $notification->itemtype = "sectionuser";
             } else {
                 if ($itemtype == "clubuser") {
                     $object = ClubUser::get_by_id($itemid);
                     $object->pending = 0;
                     $object->update();
                     $notification->title = "message";
                     $notification->itemid = $itemid;
                     $notification->itemtype = "clubuser";
                 } else {
                     if ($itemtype == "groupuser") {
                         $object = GroupUser::get_by_id($itemid);
                         $object->pending = 0;
                         $object->update();
                         $notification->title = "message";
                         $notification->itemid = $itemid;
                         $notification->itemtype = "groupuser";
                     }
                 }
             }
         }
     }
 }
 $notification->fromuserid = $session->user_id;
 $notification->touserid = $touserid;
 $notification->create();
 $lastnotification = Notification::get_by_id($notificationid);
コード例 #26
0
 function removeUserOfGroup($GrpUid, $UsrUid)
 {
     $gu = new GroupUser();
     $gu->remove($GrpUid, $UsrUid);
 }
コード例 #27
0
ファイル: getnotifications.php プロジェクト: NemOry/Skoolyf
             } else {
                 if ($notification->itemtype == "sectionuser") {
                     $object = SectionUser::get_by_id($notification->itemid);
                     $section = Section::get_by_id($object->sectionid);
                     $batch = Batch::get_by_id($object->batchid);
                     $school = School::get_by_id($object->schoolid);
                     $html .= "Now a member in Section <a href='section.php?id=" . $section->id . "'>" . $section->name . "</a> of Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
                 } else {
                     if ($notification->itemtype == "clubuser") {
                         $object = ClubUser::get_by_id($notification->itemid);
                         $club = Club::get_by_id($object->clubid);
                         $school = School::get_by_id($object->schoolid);
                         $html .= "Now a member in Club <a href='club.php?id=" . $club->id . "'>" . $club->name . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
                     } else {
                         if ($notification->itemtype == "groupuser") {
                             $object = GroupUser::get_by_id($notification->itemid);
                             $group = Group::get_by_id($object->groupid);
                             $school = School::get_by_id($object->schoolid);
                             $html .= "Now a member in Group <a href='group.php?id=" . $group->id . "'>" . $group->name . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
                         }
                     }
                 }
             }
         }
     }
     $html .= "\t\t<button class='btn btn-mini btndelete pull-right'>x<span hidden class='notificationid'>" . $notification->id . "</span></button>";
 }
 $html .= "\t\t<p>" . $notification->date . "</p>";
 $html .= "\t\t</div>";
 $html .= "  </td>";
 $html .= "</tr>";
コード例 #28
0
ファイル: invite.php プロジェクト: NemOry/Skoolyf
         $notification->title = "Invites you";
         $notification->create();
         $response = "success";
     } else {
         $theuser = ClubUser::getUser($user->id, $_GET['clubid']);
         if ($theuser->pending == 0) {
             $response = "This user is already a member.";
         } else {
             $response = "This user is already pending.";
         }
     }
 } else {
     if (isset($_GET['groupid'])) {
         if (!GroupUser::userExists($user->id, $_GET['groupid'])) {
             $group = Group::get_by_id($_GET['groupid']);
             $object = new GroupUser();
             $object->userid = $user->id;
             $object->groupid = $group->id;
             $object->level = 0;
             $object->role = "student";
             $object->enabled = 1;
             $object->pending = 1;
             $object->create();
             $notification = new Notification();
             $notification->fromuserid = $session->user_id;
             $notification->touserid = $user->id;
             $notification->itemid = $object->id;
             $notification->itemtype = "groupuser";
             $notification->title = "Invites you";
             $notification->create();
             $response = "success";
コード例 #29
0
ファイル: deletegroup.php プロジェクト: NemOry/Skoolyf
<?php

require_once "../initialize.php";
$id = $_GET['id'];
$object = Group::get_by_id($id);
GroupUser::delete_all_by_sectionid($object->id);
$object->delete();
$log = new Log($session->user_id, $clientip, "WEB", "DELETED CLUB: " . $object->id);
$log->create();
echo "success";
コード例 #30
0
 /**
  * Generate Data
  *
  * @return object criteria
  */
 public function generateData($appUid, $delPreviusUsrUid)
 {
     try {
         G::LoadClass("case");
         //Generate data
         $case = new Cases();
         $criteria = new Criteria("workflow");
         $criteria->addSelectColumn(AppDelegationPeer::APP_UID);
         $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
         $criteria->addSelectColumn(ApplicationPeer::APP_DATA);
         $criteria->addSelectColumn(AppDelegationPeer::PRO_UID);
         $criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
         $criteria->addSelectColumn(TaskPeer::TAS_UID);
         $criteria->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE);
         $criteria->addJoin(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
         $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
         $criteria->add(TaskPeer::TAS_ASSIGN_TYPE, "SELF_SERVICE", Criteria::EQUAL);
         //$criteria->add(TaskPeer::TAS_GROUP_VARIABLE, "", Criteria::NOT_EQUAL);
         $criteria->add(AppDelegationPeer::USR_UID, "", Criteria::EQUAL);
         $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", Criteria::EQUAL);
         $criteria->add(AppDelegationPeer::APP_UID, $appUid, Criteria::EQUAL);
         $rsCriteria = AppDelegationPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $applicationData = $case->unserializeData($row["APP_DATA"]);
             $taskGroupVariable = trim($row["TAS_GROUP_VARIABLE"], " @#");
             $delPreviusUsrUid = '';
             $unaUid = $this->newRow($row, $delPreviusUsrUid);
             //Selfservice by group
             if ($taskGroupVariable != "" && isset($applicationData[$taskGroupVariable]) && trim($applicationData[$taskGroupVariable]) != "") {
                 $gprUid = trim($applicationData[$taskGroupVariable]);
                 //Define Users by Group
                 $gpr = new GroupUser();
                 $arrayUsers = $gpr->getAllGroupUser($gprUid);
                 foreach ($arrayUsers as $urow) {
                     $newRow["USR_UID"] = $urow["USR_UID"];
                     $listUnassignedGpr = new ListUnassignedGroup();
                     $listUnassignedGpr->newRow($unaUid, $urow["USR_UID"], "GROUP", $gprUid);
                 }
             } else {
                 //Define all users assigned to Task
                 $task = new TaskUser();
                 $arrayUsers = $task->getAllUsersTask($row["TAS_UID"]);
                 foreach ($arrayUsers as $urow) {
                     $newRow["USR_UID"] = $urow["USR_UID"];
                     $listUnassignedGpr = new ListUnassignedGroup();
                     $listUnassignedGpr->newRow($unaUid, $urow["USR_UID"], "USER", "");
                 }
             }
         }
     } catch (Exception $e) {
         throw $e;
     }
 }