/**
  * Process headers and store in database for all active groups.
  */
 function updateAllGroups()
 {
     $n = $this->n;
     $groups = new Groups();
     $res = $groups->getActive();
     $s = new Sites();
     echo $s->getLicense();
     if ($res) {
         shuffle($res);
         $alltime = microtime(true);
         echo 'Updating: ' . sizeof($res) . ' groups - Using compression? ' . ($this->compressedHeaders ? 'Yes' : 'No') . $n;
         $nntp = new Nntp();
         if ($nntp->doConnect()) {
             $pos = 0;
             foreach ($res as $groupArr) {
                 $pos++;
                 echo 'Group ' . $pos . ' of ' . sizeof($res) . $n;
                 $this->message = array();
                 $this->updateGroup($nntp, $groupArr);
             }
             $nntp->doQuit();
             echo 'Updating completed in ' . number_format(microtime(true) - $alltime, 2) . ' seconds' . $n;
         } else {
             echo "Failed to get NNTP connection.{$n}";
         }
     } else {
         echo "No groups specified. Ensure groups are added to newznab's database and activated before updating.{$n}";
     }
 }
Example #2
0
function setUpGroups($lang)
{
    if (!file_exists(GROUP_FILE_LOCATION)) {
        $aGroupDB = new Groups();
        $aGroupDB->setFileName(GROUP_FILE_LOCATION);
        $names = ImageTypes::getMenuNames();
        foreach ($names as $name) {
            $aGroup = new Group();
            $aGroup->setType($lang[$name]);
            $aGroup->setGroupImage($name);
            $aGroup->rebuildElementLine();
            $aGroupDB->addElement($aGroup);
        }
        $aGroupDB->save();
    } else {
        // validate we have all the default groups
        $addedElement = false;
        $aGroupDB = new Groups(GROUP_FILE_LOCATION);
        $names = ImageTypes::getMenuNames();
        foreach ($names as $name) {
            if ($aGroupDB->getAGroup($name) == "") {
                $aGroup = new Group();
                $aGroup->setType($lang[$name]);
                $aGroup->setGroupImage($name);
                $aGroup->rebuildElementLine();
                $aGroupDB->addElement($aGroup);
                $addedElement = true;
            }
        }
        if ($addedElement) {
            $aGroupDB->save();
        }
    }
}
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     $this->command->info("Creating Super Admins");
     $group = new Groups();
     $group->name = "admin";
     $group->save();
     $group = new Groups();
     $group->name = "department-admin";
     $group->save();
     $group = new Groups();
     $group->name = "operator";
     $group->save();
     $group = new Groups();
     $group->name = "customer";
     $group->save();
     $admin = new User();
     $admin->name = "Admin";
     $admin->email = "*****@*****.**";
     $admin->password = Hash::make("admin");
     $admin->avatar = "/assets/images/default-avatar.jpg";
     $admin->show_avatar = 1;
     $admin->birthday = "01-15-1990";
     $admin->bio = "This is dummy admin bio";
     $admin->gender = "Male";
     $admin->mobile_no = "0000000000";
     $admin->country = "India";
     $admin->activated = 1;
     $admin->activated_at = \Carbon\Carbon::now();
     $admin->save();
     DB::table('users_groups')->insert(['user_id' => 1, 'group_id' => 1]);
 }
Example #4
0
File: Group.php Project: vijo/movim
 function onBookmark()
 {
     $this->ajaxClear();
     $g = new Groups();
     $g->ajaxHeader();
     $g->ajaxSubscriptions();
 }
 /**
  * Add user to group.
  * @ParamConverter("user", class="MiwClubPadelBundle:Users",options={"mapping"={"userid"="id"}})
  * @ParamConverter("group", class="MiwClubPadelBundle:Groups",options={"mapping"={"groupid"="id"}})
  */
 public function addUserToGroupAction(Users $user, Groups $group)
 {
     $em = $this->getDoctrine()->getManager();
     $em->getRepository('MiwClubPadelBundle:Users');
     $group->addUser($user);
     $user->addGroup($group);
     $em->flush();
     return $user;
 }
Example #6
0
 public function __construct(Groups $groups)
 {
     parent::__construct();
     $this->addText('s', 'dotaz')->setAttribute('autofocus', true);
     $this->addSelect('sortBy', 'Seřadit podle:', array(SearchRequest::SORT_TIME => 'času', SearchRequest::SORT_RELEVANCE => 'relevance'));
     $this->addText('from', 'Autor:');
     $this->addContainer('groups');
     foreach ($groups->getList() as $group) {
         $this['groups']->addCheckbox($group->id, $group->name);
     }
     $this->addSubmit('send', 'Vyhledat');
 }
function getUsers($listid, $default)
{
    global $idclient, $cfg, $auth;
    $userlist = new Users();
    $users = $userlist->getAccessibleUsers(explode(',', $auth->auth['perm']));
    $grouplist = new Groups();
    $groups = $grouplist->getAccessibleGroups(explode(',', $auth->auth['perm']));
    $tpl2 = new Template();
    $tpl2->set('s', 'NAME', 'user' . $listid);
    $tpl2->set('s', 'CLASS', 'text_small');
    $tpl2->set('s', 'OPTIONS', 'size=1');
    $tpl2->set('d', 'VALUE', 0);
    $tpl2->set('d', 'CAPTION', '--- ' . i18n("None", "workflow") . ' ---');
    if ($default == 0) {
        $tpl2->set('d', 'SELECTED', 'SELECTED');
    } else {
        $tpl2->set('d', 'SELECTED', '');
    }
    $tpl2->next();
    if (is_array($users)) {
        foreach ($users as $key => $value) {
            $tpl2->set('d', 'VALUE', $key);
            $tpl2->set('d', 'CAPTION', $value["realname"] . " (" . $value["username"] . ")");
            if ($default == $key) {
                $tpl2->set('d', 'SELECTED', 'SELECTED');
            } else {
                $tpl2->set('d', 'SELECTED', '');
            }
            $tpl2->next();
        }
    }
    $tpl2->set('d', 'VALUE', '0');
    $tpl2->set('d', 'CAPTION', '------------------------------------');
    $tpl2->set('d', 'SELECTED', 'disabled');
    $tpl2->next();
    if (is_array($groups)) {
        foreach ($groups as $key => $value) {
            $tpl2->set('d', 'VALUE', $key);
            $tpl2->set('d', 'CAPTION', $value["groupname"]);
            if ($default == $key) {
                $tpl2->set('d', 'SELECTED', 'SELECTED');
            } else {
                $tpl2->set('d', 'SELECTED', '');
            }
            $tpl2->next();
        }
    }
    return $tpl2->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true);
}
Example #8
0
 public function actionProgress($id, $trackid)
 {
     $progress = array();
     // получаем список пользователей
     // получаем задания по пользователю, сразу же с решениями
     $track = Tracks::model()->findByPk($trackid);
     $group = Groups::model()->with("Students")->findByPk($id);
     // пройдемся по всем студентам в группе
     foreach ($group->Students as $student) {
         // получим теперь таски и солюшны этого студента
         $students[$student->id] = $student;
         $tasks = Tasks::model()->with(array('Solutions' => array('on' => 'Solutions.student=' . $student->id)))->findAllByAttributes(array("track" => $trackid), array('order' => 't.order'));
         // продемся по всем задачам
         foreach ($tasks as $task) {
             if (isset($task->Solutions[0])) {
                 // если у таска есть солюшн – возьмем
                 $progress[$student->id][$task->id] = $task->Solutions[0]->status;
             } else {
                 // если нет – запишем нейтральный статус
                 $progress[$student->id][$task->id] = "undefined";
             }
         }
     }
     $this->render('progress', array("group" => $group, "track" => $track, "students" => $students, "progress" => $progress));
 }
Example #9
0
 /**
  * Function for searching on the site (by subject, searchname or advanced).
  *
  * @param string $searchName
  * @param string $usenetName
  * @param string $posterName
  * @param string $groupName
  * @param array  $cat
  * @param int    $sizeFrom
  * @param int    $sizeTo
  * @param int    $hasNfo
  * @param int    $hasComments
  * @param int    $daysNew
  * @param int    $daysOld
  * @param int    $offset
  * @param int    $limit
  * @param string $orderBy
  * @param int    $maxAge
  * @param array  $excludedCats
  * @param string $type
  *
  * @return array
  */
 public function search($searchName, $usenetName, $posterName, $groupName, $cat = [-1], $sizeFrom, $sizeTo, $hasNfo, $hasComments, $daysNew, $daysOld, $offset = 0, $limit = 1000, $orderBy = '', $maxAge = -1, $excludedCats = [], $type = 'basic')
 {
     $sizeRange = range(1, 11);
     if ($orderBy == '') {
         $orderBy = [];
         $orderBy[0] = 'postdate ';
         $orderBy[1] = 'desc ';
     } else {
         $orderBy = $this->getBrowseOrder($orderBy);
     }
     $searchOptions = [];
     if ($searchName != -1) {
         $searchOptions['searchname'] = $searchName;
     }
     if ($usenetName != -1) {
         $searchOptions['name'] = $usenetName;
     }
     if ($posterName != -1) {
         $searchOptions['fromname'] = $posterName;
     }
     $innerSql = sprintf("%s\n\t\t\tWHERE r.passwordstatus <= %d %s %s %s %s %s %s %s %s %s %s %s", $this->releaseSearch->getFullTextJoinString(), $this->showPasswords(), $maxAge > 0 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $maxAge) : '', $groupName != -1 ? sprintf(' AND r.group_id = %d ', $this->groups->getIDByName($groupName)) : '', in_array($sizeFrom, $sizeRange) ? ' AND r.size > ' . (string) (104857600 * (int) $sizeFrom) . ' ' : '', in_array($sizeTo, $sizeRange) ? ' AND r.size < ' . (string) (104857600 * (int) $sizeTo) . ' ' : '', $hasNfo != 0 ? ' AND r.nfostatus = 1 ' : '', $hasComments != 0 ? ' AND r.comments > 0 ' : '', $type !== 'advanced' ? $this->categorySQL($cat) : ($cat[0] != '-1' ? sprintf(' AND (r.categoryid = %d) ', $cat[0]) : ''), $daysNew != -1 ? sprintf(' AND r.postdate < (NOW() - INTERVAL %d DAY) ', $daysNew) : '', $daysOld != -1 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $daysOld) : '', count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : '', count($searchOptions) > 0 ? $this->releaseSearch->getSearchSQL($searchOptions) : '');
     $sql = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM (\n\t\t\t\tSELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name,\n\t\t\t\tCONCAT(cp.id, ',', c.id) AS category_ids,\n\t\t\t\tgroups.name AS group_name, rn.id AS nfoid,\n\t\t\t\tre.releaseid AS reid, cp.id AS categoryparentid\n\t\t\t\tFROM releases r\n\t\t\t\tLEFT OUTER JOIN releasevideo re ON re.releaseid = r.id\n\t\t\t\tLEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id\n\t\t\t\tINNER JOIN groups ON groups.id = r.group_id\n\t\t\t\tINNER JOIN category c ON c.id = r.categoryid\n\t\t\t\tINNER JOIN category cp ON cp.id = c.parentid\n\t\t\t\t%s\n\t\t\t) r\n\t\t\tORDER BY r.%s %s\n\t\t\tLIMIT %d OFFSET %d", $innerSql, $orderBy[0], $orderBy[1], $limit, $offset);
     $releases = $this->pdo->query($sql);
     if ($releases && count($releases)) {
         $releases[0]['_totalrows'] = $this->pdo->get_Found_Rows();
     }
     return $releases;
 }
Example #10
0
 public function toCode($var, $parent = NULL)
 {
     if (count($this->args) !== 3) {
         throw new \InvalidArgumentException("@When expects three arguments");
     }
     return parent::toCode($var, $parent);
 }
Example #11
0
 /**
  * Reset some variables for the current release.
  */
 protected function _resetReleaseStatus()
 {
     // Only process for samples, previews and images if not disabled.
     $this->_foundVideo = $this->_processVideo ? false : true;
     $this->_foundMediaInfo = $this->_processMediaInfo ? false : true;
     $this->_foundAudioInfo = $this->_processAudioInfo ? false : true;
     $this->_foundAudioSample = $this->_processAudioSample ? false : true;
     $this->_foundJPGSample = $this->_processJPGSample ? false : true;
     $this->_foundSample = $this->_processThumbnails ? false : true;
     $this->_foundSample = $this->_release['disablepreview'] == 1 ? true : false;
     $this->_foundPAR2Info = false;
     $this->_passwordStatus = [\Releases::PASSWD_NONE];
     $this->_releaseHasPassword = false;
     $this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupid']);
     $this->_releaseHasNoNFO = false;
     // Make sure we don't already have an nfo.
     if ($this->_release['nfostatus'] != 1) {
         $this->_releaseHasNoNFO = true;
     }
     $this->_NZBHasCompressedFile = false;
     $this->_sampleMessageIDs = $this->_JPGMessageIDs = $this->_MediaInfoMessageIDs = [];
     $this->_AudioInfoMessageIDs = $this->_RARFileMessageIDs = [];
     $this->_AudioInfoExtension = '';
     $this->_addedFileInfo = 0;
     $this->_totalFileInfo = 0;
     $this->_compressedFilesChecked = 0;
 }
Example #12
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new X2Leads();
     $users = User::getNames();
     foreach (Groups::model()->findAll() as $group) {
         $users[$group->id] = $group->name;
     }
     unset($users['admin']);
     unset($users['']);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['X2Leads'])) {
         $temp = $model->attributes;
         $model->setX2Fields($_POST['X2Leads']);
         if (isset($_POST['x2ajax'])) {
             $ajaxErrors = $this->quickCreate($model);
         } else {
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     if (isset($_POST['x2ajax'])) {
         $this->renderInlineCreateForm($model, isset($ajaxErrors) ? $ajaxErrors : false);
     } else {
         $this->render('create', array('model' => $model, 'users' => $users));
     }
 }
Example #13
0
 /**
  * Picks the next asignee based on the routing type
  * 
  * @return string Username that should be assigned the next lead
  */
 public function getNextAssignee()
 {
     $admin =& Yii::app()->settings;
     $type = $admin->serviceDistribution;
     if ($type == "") {
         return "Anyone";
     } elseif ($type == "evenDistro") {
         return $this->evenDistro();
     } elseif ($type == "trueRoundRobin") {
         return $this->roundRobin();
     } elseif ($type == 'singleUser') {
         $user = User::model()->findByPk($admin->srrId);
         if (isset($user)) {
             return $user->username;
         } else {
             return "Anyone";
         }
     } elseif ($type == 'singleGroup') {
         $group = Groups::model()->findByPk($admin->sgrrId);
         if (isset($group)) {
             return $group->id;
         } else {
             return "Anyone";
         }
     }
 }
 /**
  * 修改个人信息
  */
 function actionChangeInfo()
 {
     $this->_pathway->addStep('个人信息');
     $currentUser = $this->_app->currentUser();
     $user = Users::find()->getById($currentUser['id']);
     $form = new Form_User(url('admin::usercenter/changeInfo'));
     $form->element('username')->set('readonly', 'true');
     $form->remove('password');
     $form->element('group_id')->items = Groups::find('id=?', $user->group_id)->order('weight desc')->getAll()->toHashMap('id', 'name');
     $form->element('level_id')->items = Levels::find('weight=?', $user->level_id)->order('weight desc')->getAll()->toHashMap('weight', 'name');
     $form->remove('enabled');
     $form->add(QForm::ELEMENT, 'id', array('_ui' => 'hidden', 'value' => $currentUser['id']));
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         try {
             $user->changeProps($form->values());
             $user->save();
             return "{msg:'编辑成功'}";
         } catch (QDB_ActiveRecord_ValidateFailedException $ex) {
             $form->invalidate($ex);
         }
     } else {
         $form->import($user);
     }
     $form->add(QForm::ELEMENT, 'reg_at', array('_ui' => 'textbox', '_label' => '注册时间', 'value' => date('Y-m-d', $user->register_at), 'class' => 'txt w200', 'readonly' => 'true'));
     $form->add(QForm::ELEMENT, 'reg_ip', array('_ui' => 'textbox', '_label' => '注册IP', 'value' => $user->register_ip, 'class' => 'txt w200', 'readonly' => 'true'));
     $form->add(QForm::ELEMENT, 'log_at', array('_ui' => 'textbox', '_label' => '最后登录时间', 'value' => $user->login_at == 0 ? '0000-00-00' : date('Y-m-d', $user->login_at), 'class' => 'txt w200', 'readonly' => 'true'));
     $form->add(QForm::ELEMENT, 'log_ip', array('_ui' => 'textbox', '_label' => '最后登录IP', 'value' => $user->login_ip, 'class' => 'txt w200', 'readonly' => 'true'));
     $form->add(QForm::ELEMENT, 'log_count', array('_ui' => 'textbox', '_label' => '登录次数', 'value' => $user->login_count, 'class' => 'txt w200', 'readonly' => 'true'));
     $this->_view['form'] = $form;
 }
Example #15
0
 /**
  * A basic fixture test example
  *
  * @return void
  */
 public function testBasicFixture()
 {
     $user = Sentry::findUserByLogin('*****@*****.**');
     $this->assertEquals('Benevolent', $user->first_name);
     $this->assertEquals('Dictator', $user->last_name);
     $brand = Groups::getBrandProvider()->findByTitle('BizGym');
     $this->assertTrue(Groups::isAdmin($user->id, $brand->id));
 }
 public function run()
 {
     // Refresh Brand_user_groups
     DB::table('group_user_brand')->truncate();
     $entries = array(array('user_id' => Sentry::findUserByLogin('*****@*****.**')->id, 'group_id' => Sentry::findGroupByName('Admin')->id, 'brand_id' => Groups::getBrandProvider()->findByTitle('BizGym')->id), array('user_id' => Sentry::findUserByLogin('*****@*****.**')->id, 'group_id' => Sentry::findGroupByName('User')->id, 'brand_id' => Groups::getBrandProvider()->findByTitle('SaaS Venture Group')->id), array('user_id' => Sentry::findUserByLogin('*****@*****.**')->id, 'group_id' => Sentry::findGroupByName('Admin')->id, 'brand_id' => Groups::getBrandProvider()->findByTitle('BizGym')->id), array('user_id' => Sentry::findUserByLogin('*****@*****.**')->id, 'group_id' => Sentry::findGroupByName('User')->id, 'brand_id' => Groups::getBrandProvider()->findByTitle('SaaS Venture Group')->id));
     // Uncomment the below to run the seeder
     DB::table('group_user_brand')->insert($entries);
 }
Example #17
0
    public function buildGroupTable()
    {
        if (!defined('SHOW_RPG') || SHOW_RPG != 'checked') {
            return;
        }
        print '<div class="row-fluid">
				<div class="box span12">
					<div class="box-header well" data-original-title>
						<h2><i class="icon-th"></i> Releases per Group</h2>
						<div class="box-icon">

							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
													</div>
					</div>
					<div class="box-content">';
        echo '<table class="table table-striped table-bordered bootstrap-datatable datatable">
							  <thead>
								  <tr>
									  <th>Group</th>
									  <th>Releases</th>
								  </tr>
							  </thead>
							  <tbody>';
        $group = new Groups();
        # get all the groups
        $allgroups = $group->getAll();
        $pdo = new Settings();
        foreach ($allgroups as $group) {
            $sql = sprintf("select count(id) as num from releases where groupid = %s", $group['id']);
            $res = $pdo->queryOneRow($sql);
            if ($res["num"] > 0) {
                echo '<tr>';
                echo '<td>';
                echo $group['name'];
                echo '</td>';
                echo '<td class="right">';
                echo $res["num"];
                echo '</td>';
                echo '</tr>';
            }
        }
        echo '</tbody>
						 </table>  ';
        print '</div></div></div>';
    }
Example #18
0
 public function __construct()
 {
     $groups = new Groups();
     $doc = new Documents();
     /**
      * Wenn gepostet wurde
      */
     if ($_POST) {
         // Gruppe wird erstellt
         if (isset($_POST["group_name"])) {
             $groups->saveGroup($this->saveInputs($_POST["group_name"]), $this->saveInputs($_POST["group_description"]), get_current_user_id());
         }
         // User wird hinzugefügt
         if (isset($_POST["userToAdd"])) {
             $groups->addUser($this->saveInputs($_POST["group_id"]), $this->saveInputs($_POST["userToAdd"]));
         }
         if (isset($_POST["userToDelete"])) {
             $groups->deleteUser($this->saveInputs($_POST["group_id"]), $this->saveInputs($_POST["userToDelete"]));
         }
     }
     // Bestimmte ID wird abgefragt
     if (isset($_GET["id"])) {
         $user = wp_get_current_user();
         $detailGroup = $groups->getGroupAndUsers($this->saveInputs($_GET["id"]));
         $detailGroup->userToAdd = array();
         if ($user->roles[0] == "dokuAdmin" || $user->roles[0] == "administrator") {
             $detailGroup->userToAdd = $groups->getUserNotInGroup($this->saveInputs($_GET["id"]));
         }
         $documentsInGroup = $doc->getDocumentsInGroup($this->saveInputs($_GET["id"]));
         echo $this->detailView($detailGroup, $documentsInGroup);
     } else {
         $arGroups = $groups->getAuthGroups();
         echo $this->groupView($arGroups);
     }
 }
Example #19
0
 public function createGroupPostAndComment()
 {
     $this->user = $this->createUsers();
     $this->group = $this->createGroup($this->user->id);
     $this->post = $this->createPost($this->user->id);
     $this->group->attachPost($this->post->id);
     $this->comment = ['post_id' => $this->post->id, 'user_id' => $this->user->id, 'body' => 'This is my comment'];
     return Groups::addComment($this->comment);
 }
Example #20
0
 public function makeOrderRecalc()
 {
     $obj = new Groups();
     $obj->isRecalc = false;
     $groups = $obj->get();
     $orderArr = $atLast = [];
     foreach ($groups as $gr) {
         if ($gr->order_id == null) {
             $atLast[] = $gr->id;
         } else {
             $orderArr[$gr->order_id] = $gr->id;
         }
     }
     ksort($orderArr);
     $newOrderArr = array_values($orderArr);
     $finalOrderArr = array_merge($newOrderArr, $atLast);
     foreach ($finalOrderArr as $orderId => $id) {
         $obj->update(['id' => $id], ['order_id' => $orderId]);
     }
 }
 public function creategroupAction()
 {
     if ($this->request->isPost() == true) {
         try {
             $this->response->setContentType('application/json');
             $groupname = $this->request->getPost('groupname', 'striptags');
             $user_id = $this->request->getPost('user_id');
             $group = new Groups();
             $group->assign(array('user_id' => $user_id, 'name' => $groupname, 'created_at' => (new \DateTime())->format('Y-m-d H:i:s'), 'updated_at' => (new \DateTime())->format('Y-m-d H:i:s')));
             if ($group->save()) {
                 $data = array('status' => 'success', 'msg' => 'group created', 'code' => 2, 'group_name' => $group->name);
             }
             $this->response->setContent(json_encode($data));
             $this->response->send();
         } catch (Exception $ex) {
             $this->response->setContent(json_encode(array('error' => $ex->getMessage())));
             $this->response->send();
         }
     }
 }
Example #22
0
 public static function getMyOrganisations($detail = FALSE)
 {
     if ($detail) {
         return Groups::getGroups(_ORGANISATION_GROUP);
     } else {
         $user_id = $GLOBALS['user']->uid;
         $table = tableName(_ORGANISATION_GROUP);
         $orgids = db_query("SELECT o.org_id from {$table} as o " . "LEFT JOIN soc_user_membership as um on o.org_id = um.group_id " . "WHERE um.uid = {$user_id} AND um.type = :organisation", array(':organisation' => _ORGANISATION_GROUP))->fetchCol();
     }
     return $orgids;
 }
Example #23
0
 public function subscriberCounterStat()
 {
     $count = 0;
     $subscriber = Group::where('name', 'LIKE', '%ubscrib%')->first();
     if ($subscriber) {
         $related = Groups::getRelationProvider()->createModel()->where('group_id', '=', $subscriber->id);
         $count = count($related->get());
     }
     $this->widgetData = array('count' => $count);
     $this->setupWidgetLayout(__METHOD__);
 }
 public function create()
 {
     $group = Groups::where("name", "admin")->first();
     $user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
     if (sizeof($user_ids) > 0) {
         $this->data["users"] = User::whereIn("id", $user_ids)->get();
     } else {
         $this->data["users"] = [];
     }
     return View::make('companies.create', $this->data);
 }
 function __construct($config, $auth = NULL)
 {
     parent::__construct($config, $auth);
     osapiLogger::setLevel(osapiLogger::INFO);
     osapiLogger::setAppender(new osapiFileAppender("data/osapi.log"));
     $host = getConfig($config, 'conext_host', TRUE);
     $key = getConfig($config, 'conext_key', TRUE);
     $secret = getConfig($config, 'conext_secret', TRUE);
     $provider = new osapiProvider("https://{$host}/oauth/request_token", "https://{$host}/oauth/authorize", "https://{$host}/oauth/access_token", "https://{$host}/social/rest", "https://{$host}/social/rpc", 'SURFconext', TRUE, NULL);
     $auth = new osapiOAuth2Legged($key, $secret, $this->auth->getUserId());
     $this->osapi = new osapi($provider, $auth);
 }
Example #26
0
 /**
  * Erstellt die Sidebar mit Dokumenten, Gruppen usw.
  */
 public function __construct()
 {
     $docs = new Documents();
     $this->authDocs = $docs->getDocumentsCreatedByUser(get_current_user_id());
     $groups = new Groups();
     $this->authGroups = $groups->getAuthGroups();
     /**
      * SeitenUrl holen
      * @var array
      */
     $pagesFilter = array('post_type' => 'page', 'meta_key' => 'custom_element_grid_class_meta_box', 'meta_value' => 'Gruppen');
     $pages = get_posts($pagesFilter);
     $GroupLink = get_permalink($pages[0]->ID);
     $pagesFilter["meta_value"] = "Dokumente";
     $pages = get_posts($pagesFilter);
     $documentLink = get_permalink($pages[0]->ID);
     $pagesFilter["meta_value"] = "Startseite";
     $pages = get_posts($pagesFilter);
     $homeLink = get_permalink($pages[0]->ID);
     echo $this->view($GroupLink, $documentLink, $homeLink);
 }
/**
 * Diese Funktions erstellt Rollen und DB-Tables bei der Aktivierung des Plugins im WP-Backend.
 */
function dokumummy_activated()
{
    /**
     * Rolen registrieren
     */
    new RoleSetup();
    /**
     * Seiten erstellen
     */
    new PageSetup();
    /**
     * Datenbanken für Gruppen erstellen
     */
    $groups = new Groups();
    $groups->initDatabase();
    /**
     * Datenbanken für Dokumente erstellen
     */
    $documents = new Documents();
    $documents->initDatabase();
}
Example #28
0
 /**
  * Delete a Hotel Type
  */
 public function deleteAction()
 {
     $Group = Groups::getById($this->getRequest()->getParam('id'));
     if ($Group) {
         if ($this->getRequest()->isPost()) {
             $Group->delete();
             $this->Member->log('Delete hotel type:' . $Group->name . '(' . $this->getRequest()->getParam('id') . ')', 'Groups');
             $this->_redirect($this->_helper->url('index', 'Groups', 'admin'));
         }
         $this->view->Groups = $Group;
     }
 }
Example #29
0
function print_groups($group)
{
    $groups = Groups::get_by_parent($group);
    if ($groups) {
        echo "<ul>";
        foreach ($groups as $group) {
            echo "<li data-group-id=\"" . $group->get_id() . "\" data-description=\"" . $group->get_description() . "\">" . $group->get_name() . "</li>";
            print_groups($group);
        }
        echo "</ul>";
    }
}
 /**
  * Update all active groups categories and descriptions.
  */
 function backfillAllGroups($groupName = '', $backfillDate = null, $regexOnly = false)
 {
     $n = $this->n;
     $groups = new Groups();
     $res = false;
     if ($groupName != '') {
         $grp = $groups->getByName($groupName);
         if ($grp) {
             $res = array($grp);
         }
     } else {
         $res = $groups->getActive();
     }
     if ($res) {
         foreach ($res as $groupArr) {
             $this->backfillGroup($groupArr, $backfillDate, $regexOnly);
         }
     } else {
         echo "No groups specified. Ensure groups are added to newznab's database for updating.{$n}";
     }
 }