public function manage(DmRecordPermission $permission) { if (!$this->user->getUser()) { return; } $userId = $this->user->getUser()->get($this->user->getUser()->getTable()->getIdentifier()); $query = dmDb::table('DmRecordPermissionAssociation')->createQuery('p')->select('p.id, p.dm_secure_module, p.dm_secure_action, p.dm_secure_model, g.id, u.id')->leftJoin('p.Groups g')->leftJoin('p.Users u')->addWhere('p.dm_secure_module = ?', $permission->get('secure_module'))->addWhere('p.dm_secure_action = ?', $permission->get('secure_action'))->addWhere('p.dm_secure_model = ?', $permission->get('secure_model')); $query = $this->context->getEventDispatcher()->filter(new sfEvent($permission, 'dm_record_permission_association_manager.filter_query'), $query)->getReturnValue(); $associations = $query->execute(); $this->associate($permission, $associations); }
/** * @static * * @param myUser $user * @param Criteria|null $criteria * * @return JenkinsRun[] */ public static function getDelayed(myUser $user, Criteria $criteria = null) { if (!$user->isAuthenticated()) { return; } if (null === $criteria) { $criteria = new Criteria(); } $criteria->addJoin(JenkinsRunPeer::JENKINS_GROUP_RUN_ID, JenkinsGroupRunPeer::ID, Criteria::JOIN); $criteria->add(JenkinsGroupRunPeer::SF_GUARD_USER_ID, $user->getUserId(), Criteria::EQUAL); $criteria->add(JenkinsRunPeer::LAUNCHED, 0, Criteria::EQUAL); return self::doSelect($criteria); }
/** * Performs the actual authentication, calling parent if web request's data is missing * * @param string $usermail the mail address of the user to authenticate (entered or from Shibboleth) * @param string $password the password entered into the login form, empty in case of Shibboleth * @param sfWebRequest $request the current web request * */ public function authenticate($usermail, $password, $request = NULL) { $authenticated = false; // if Shibboleth Data is missing, hand back to default auth if (NULL === $request) { $authenticated = parent::authenticate($usermail, $password); // Load user $criteria = new Criteria(); $criteria->add(QubitUser::EMAIL, $usermail); $user = QubitUser::getOne($criteria); } else { $params = $request->getPathInfoArray(); if (strlen($params['Shib-Session-Index']) >= 8) { $authenticated = true; // Load user using username or, if one doesn't exist, create it $criteria = new Criteria(); $criteria->add(QubitUser::EMAIL, $usermail); if (null === ($user = QubitUser::getOne($criteria))) { $user = $this->createUserFromShibInfo($request); } $this->updateUserFromShibInfo($request, $user); } else { return false; } } // Sign in user if authentication was successful if ($authenticated) { $this->signIn($user); } return $authenticated; }
public function queryIncompleteByUserId($sort = "id ASC") { $q = Doctrine_Query::Create()->from('Task t')->where('t.user_id = ?', myUser::getLoggedIn()->getId())->andWhere('t.task_status_id <> ?', 3); if ($this->queryWhereClientAccounts($q)) { $q->andWhere('t.task_status_id <> ?', 3); } return $q->orderBy('t.' . $sort); }
public function configure() { $this->unsetTimeStampable(); $this->embedUser(); if (!myUser::getLoggedIn()->isSuperAdmin()) { unset($this['track_record']); } }
public function saveNewUpdate($conn = null) { $this->updateObject(); $OM = $this->getObject(); $OM->save(); myUser::resizeImage(800, 600, sfConfig::get('sf_web_dir') . '/' . $this->WEB_IMATGE, $OM->getUrl(), $OM->getMultimediaId() . '-L', false); $nom = myUser::resizeImage(150, 150, sfConfig::get('sf_web_dir') . '/' . $this->WEB_IMATGE, $OM->getUrl(), $OM->getMultimediaId(), true); $OM->setUrl($nom); $OM->save(); }
public function execute(&$value, &$error) { $user_id = sfContext::getInstance()->getUser()->getId(); $user_private_data = UserPrivateData::find($user_id); if (!myUser::check_password($value, $user_private_data->password)) { $error = $this->getParameterHolder()->get('bad_password_error'); return false; } return true; }
public function execute($filterChain) { if ($this->isFirstCall()) { if (!isset($_SERVER['PHP_AUTH_USER'])) { $this->sendHeaders(); exit; } $user = QubitUser::checkCredentials($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $error); if (null === $user) { $this->sendHeaders(); return; } $user = new myUser(new sfEventDispatcher(), new sfNoStorage()); $user->authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); // We'll need username/email details later sfContext::getInstance()->request->setAttribute('user', $user); } $filterChain->execute(); }
public function EnviaMissatgeGlobalHospici() { $ADMIN = OptionsPeer::getString('MAIL_ADMIN', $this->getSiteId()); //Carreguem el correu de l'administrador $MAILS = UsuarisPeer::getAdminMails(); //Carreguem els mails dels administradors $BODY = OptionsPeer::getString('BODY_MAIL_MISSATGE_GLOBAL', $this->getSiteId()); $BODY = str_replace('{NOM}', $this->getUsuaris()->getNomComplet(), $BODY); $BODY = str_replace('{SITE}', $this->getSiteNom(), $BODY); $BODY = str_replace('{ENLLAC}', 'http://www.casadecultura.cat/gestio/gMissatges?accio=E&IDM=' . $this->getMissatgeid(), $BODY); $SUBJECT = 'Hospici : Nou missatge global'; myUser::sendMail($ADMIN, $MAILS, $SUBJECT, $BODY); }
public function executeFacebookCallback(sfWebRequest $request) { $fb_user = myUser::getFacebook()->getUser(); if ($fb_user) { $profile = myUser::getFbUserProfile(); $user = myUser::updateOrCreateFbUser($profile); $this->context->getUser()->signIn($user); $this->getUser()->setFlash('notice', 'Welcome !'); $this->redirect('@profile_home'); } else { $this->getUser()->setFlash('notice', 'Some problems with Facebook connection... Please try later. '); $this->redirect('@homepage'); } //$this->setTemplate(sfConfig::get('sf_app_module_dir') . '/' . 'sfGuardAuth/'. 'templates/' .'index'); }
/** * Get list of encoders and conservators available if at least conservator * Get the list of himself if encoder ... Otherwise sends nothing * @param myUser $user A doctrine myUser class object containing informations about the current user * @return mixed[] A collection of users entries */ public function getRestrictedEncodersList(myUser $user) { $result = array(); $q = Doctrine_Query::create()->select('u.id')->addSelect('u.formated_name')->from('Users u')->where('u.db_user_type >= 2')->orderBy('u.formated_name_indexed'); if ($user->isA(Users::ENCODER)) { $q->addWhere('u.id = ?', array($user->getId())); } elseif (!$user->isAtLeast(Users::MANAGER)) { return $result; } else { $result[] = $this->getI18N()->__('All'); } $results = $q->fetchArray(); foreach ($results as $results_item) { $result[$results_item['id']] = $results_item['formated_name']; } return $result; }
public function actionEdit() { $data['login'] = ""; $data['email'] = ""; $data['password'] = ""; $this->get(); $this->post(); $error = ""; //print_r($this->post); try { if (empty($this->get['id'])) { throw new Exception("EMPTY_ID"); } $id = $this->get['id']; $edit_user = new myUser($this->db, $id); $data = $edit_user->data; $data_arr['id'] = $this->get['id']; if (!empty($this->post)) { if (empty($this->post['email'])) { throw new Exception("NOT_ENTERED_EMAIL"); } if (!empty($this->post['password']) && !empty($this->post['password2'])) { if ($this->post['password'] !== $this->post['password2']) { throw new Exception("PASSWORDS_NOT_IDENTICAL"); } } if (!empty($this->post['role'])) { $data_arr['role'] = $this->post['role']; } $data_arr['email'] = $this->post['email']; $data_arr['login'] = $this->post['login']; $data_arr['original_pass'] = ""; if (SAVE_ORIGINAL_PASS) { $data_arr['original_pass'] = $this->post['password']; } $edit_user->saveFields($data_arr); $edit_user->changePass($this->post['password']); } } catch (Exception $e) { $error = $e->getMessage(); } $this->assign('role_options', $this->user->roles); $this->assign("error", $error); $this->assign("data", $data); $this->render("admin/user/item.tpl"); }
protected function renderWindow($window) { if (is_callable($window)) { return call_user_func_array($window, array($this->helper)); } elseif (is_array($window)) { $options = isset($window['options_param']) ? $this->serviceContainer->getParameter($window['options_param']) : array(); if (isset($options['callback'])) { $window['options'] = $options; return call_user_func_array($window, array($this->helper)); } else { $can = true; if (isset($options['credentials'])) { $can = $this->user->can($options['credentials']); } return $can ? $this->helper->renderComponent($window['module'], $window['component'], array_merge(array('options' => $options), $window['params'])) : ''; } } return ''; }
public function getNomForUrl() { $nom = $this->getTitolmenu(); return myUser::text2url($nom); }
/** * Facebook Auth * @return array('id' = 0,'logUrl') * */ public static function f_FbAuth($logout = false, $redirect_uri = null) { $RET = array('user' => 0, 'logUrl' => ''); $A = array('redirect_uri' => $redirect_uri); #Creem l'objecte facebook $facebook = myUser::getFbObject(); # Carreguem l'usuari que tenim en sessió (0 si no existeix) $uid = $facebook->getUser(); # Generem la url de login $RET['logUrl'] = $facebook->getLoginUrl($A); # Si l'usuari existeix en sessió, carreguem les seves dades if ($uid) { try { #Provem a veure si l'usuari existeix $RET['user'] = $facebook->api('/me'); } catch (FacebookApiException $e) { } } return $RET; }
<?php if (sizeof($LLISTAT_ESPAIS) == 0) { ?> <tr> <td colspan="3">No hem trobat cap resultat amb les dades marcades.</td> </tr> <?php } else { //Agafem el llistat d'activitats $LESP = $LLISTAT_ESPAIS; foreach ($LESP as $OE) { $url = url_for('@hospici_espai_detall?idE=' . $OE->getEspaiid() . '&titol=' . $OE->getNomForUrl()); $POBLACIO = SitesPeer::getPoblacioSite($OE->getSiteid()); $NOM = '<a id="link" style="font-size:14px;" href="' . $url . '">' . $OE->getNom() . ' </a><span style="font-size:10px; color:gray;"></span>'; $ESTAT = myUser::ph_getEtiquetaReservaEspais($AUTH, $url); $FOTOS = ""; foreach ($OE->getFotos() as $OM) { $FOTOS .= '<a class="lightbox" href="/images/multimedia/' . $OM->getLargeImage() . '">'; $FOTOS .= '<img src="/images/multimedia/' . $OM->getUrl() . '" height="30" alt="" />'; $FOTOS .= '</a>'; } ?> <tr> <td style="vertical-align: top;"><?php echo $NOM; ?> <br /> <span style="color:#D79E58"><?php
public function execute($filterChain) { // get the cool stuff /** @var sfContext **/ $context = $this->getContext(); /** @var sfController **/ $controller = $context->getController(); /** @var sfUser **/ $user = $context->getUser(); /** @var sfRequest **/ $request = $context->getRequest(); if ($request->getCookie('MyWebSite')) { // sign in $user->setAuthenticated(true); } if (!$user->isAuthenticated()) { //this will make sure we are really signed out $user->signOut(); // we bail $filterChain->execute(); } $key = false; // get the current action instance /** @var sfActionStackEntry **/ $actionEntry = $controller->getActionStack()->getLastEntry(); $actionInstance = $actionEntry->getActionInstance(); $action = $request->getParameter('action'); //get the object security information $securityArray = $actionInstance->getSecurityConfiguration(); $objectCredArray = myUser::parseSecurity($securityArray, $action); //The module is either the current module or the parent module. if (isset($objectCredArray['module'])) { $module = $objectCredArray['module']; } else { $module = $context->getModuleName(); } //object credentials are stored in // $user->getAttribute($module,'','object_credentials') //the key for the object credentials comes from: // request param // the key of a stored parent object (need to know the parent object) //so next we need to know the key... //big hack because I'm frustrated: if ('import' == $module) { if ($request->getParameter('vocabulary_id')) { $key = $request->getParameter('vocabulary_id'); $module = 'vocabulary'; } if ($request->getParameter('schema_id')) { $key = $request->getParameter('schema_id'); $module = 'schema'; } } //Does the request parameter exist? if (isset($objectCredArray['request_param'])) { $key = $request->getParameter($objectCredArray['request_param'],''); //get the correct id to check against, but only if we haven't already checked it in this request } //use the default only if we're using the current request elseif ($module == $context->getModuleName()) { //we do the default $key = $request->getParameter('id'); } //still no key? //ok, so this is definitely a hack... if (!$key && (('edit' == $action || 'show' == $action || 'list' == $action) || $module != $context->getModuleName())) { if ('schema' == $module) { $schema = myActionTools::findCurrentSchema(); if ($schema) { $key = $schema->getId(); } } if ('vocabulary' == $module) { $vocabulary = myActionTools::findCurrentVocabulary(); if ($vocabulary) { $key = $vocabulary->getId(); } } if ('agent' == $module) { $agent = myActionTools::findCurrentAgent(); if ($agent) { $key = $agent->getId(); } } } if ($key) { $user->buildModCredentials($key, $module); if ('vocabulary' == $module) { $vocabulary = myActionTools::findCurrentVocabulary(); if ($vocabulary) { $agentId = $vocabulary->getAgentId(); $user->buildModCredentials($agentId, 'agent', true); } } } //skip re-setting the modcredentials if the action == create else { $this->setdefaultCred($user); } // Execute next filter $filterChain->execute(); }
public function executeGConfig(sfWebRequest $request) { $this->setLayout('gestio'); $this->IDS = $this->getUser()->getSessionPar('idS'); $this->accio = $request->getParameter('accio', 'C'); $ROPTIONS = $request->getParameter('options', array('option_id' => '0')); $RESPAIS = $request->getParameter('espais', array('EspaiID' => '0')); $RMATERIAL = $request->getParameter('materialgeneric', array('idMaterialGeneric' => '')); $RDESCOMPTE = $request->getParameter('descomptes', array('idDescompte' => '0')); $this->FOPTIONS = OptionsPeer::initialize($ROPTIONS['option_id'], $this->IDS, false); $this->FESPAIS = EspaisPeer::initialize($RESPAIS['EspaiID'], $this->IDS); $this->FMATERIAL = MaterialgenericPeer::initialize($RMATERIAL['idMaterialGeneric'], $this->IDS); $this->FENTITAT = SitesPeer::initialize($this->IDS); //$this->FDESCOMPTE = DescomptesPeer::initialize( $RDESCOMPTE['idDescompte'] , $this->IDS ); //Agafem el codi de facebook de l'usuari $this->FBI = UsuarisPeer::getUserFbCode($this->getUser()->getSessionPar('idU')); $this->PARS = array(); $this->PARS = myUser::f_FbAuth(false, $this->getController()->genUrl('@fb_link', true)); //Carreguem les dades del facebook. $this->ERROR = ""; if ($request->hasParameter('BNEWOPTION')) { $this->accio = 'NEW_OPTION'; } if ($request->hasParameter('BSAVEOPTION')) { $this->accio = 'SAVE_OPTION'; } if ($request->hasParameter('BSAVEESPAI')) { $this->accio = 'SAVE_ESPAI'; } if ($request->hasParameter('BDELETEESPAI')) { $this->accio = 'DELETE_ESPAI'; } if ($request->hasParameter('BSAVEMATERIAL')) { $this->accio = 'SAVE_MATERIAL'; } if ($request->hasParameter('BDELETEMATERIAL')) { $this->accio = 'DELETE_MATERIAL'; } if ($request->hasParameter('BSAVESITE')) { $this->accio = 'SAVE_SITE'; } if ($request->hasParameter('BSAVEDESCOMPTE')) { $this->accio = 'SAVE_DESCOMPTE'; } switch ($this->accio) { case 'AJAX_OPCIO': return $this->renderText(OptionsPeer::getString($request->getParameter('IDO'), $this->IDS)); break; case 'NEW_OPTION': $this->FOPTIONS = OptionsPeer::initialize($ROPTIONS['option_id'], $this->IDS, true); break; case 'SAVE_OPTION': $this->FOPTIONS->bind($ROPTIONS); if ($this->FOPTIONS->isValid()) { $this->FOPTIONS->save(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FOPTIONS->getObject()); $this->FOPTIONS = OptionsPeer::initialize($this->FOPTIONS->getObject()->getOptionId(), $this->IDS, false); } break; case 'SAVE_ESPAI': //Si entrem un espai que és 0, llavors vol dir que fem un nou espai if ($RESPAIS['EspaiID'] == 0) { unset($RESPAIS['EspaiID']); } $this->FESPAIS->bind($RESPAIS, $request->getFiles('espais')); if ($this->FESPAIS->isValid()) { $this->FESPAIS->save(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FESPAIS->getObject()); $this->FESPAIS = EspaisPeer::initialize($this->FESPAIS->getObject()->getEspaiid(), $this->IDS); } //Agafem els multimèdia dels paràmetres $AMR = $request->getParameter('multimedia'); $FMR = $request->getFiles('multimedia'); foreach ($AMR as $K => $MR) { if ($MR['accio'] == 1 || $MR['accio'] == 0) { //És nou o una modificació $FM = MultimediaPeer::initialize($MR['multimedia_id'], $MR['site_id'], $MR['taula'], $MR['id_extern'], $K); $FM->bind($MR, $FMR[$K]); $FM->saveNewUpdate(); } elseif ($MR['accio'] == 2) { //S'ha d'esborrar $FM = MultimediaPeer::initialize($MR['multimedia_id'], $MR['site_id'], $MR['taula'], $MR['id_extern'], $K); $FM->delete(); } } break; case 'DELETE_ESPAI': $this->FESPAIS->getObject()->setActiu(false)->save(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FESPAIS->getObject()); $this->FESPAIS = EspaisPeer::initialize(0, $this->IDS); break; case 'SAVE_MATERIAL': //Si entrem un espai que és 0, llavors vol dir que fem un nou espai if ($RMATERIAL['idMaterialGeneric'] == 0) { unset($RMATERIAL['idMaterialGeneric']); } $this->FMATERIAL->bind($RMATERIAL); if ($this->FMATERIAL->isValid()) { $this->FMATERIAL->save(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FMATERIAL->getObject()); $this->FMATERIAL = MaterialgenericPeer::initialize($this->FMATERIAL->getObject()->getIdmaterialgeneric(), $this->IDS); } break; case 'DELETE_MATERIAL': $this->FMATERIAL->getObject()->setInactiu(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FMATERIAL->getObject()); $this->FMATERIAL = MaterialgenericPeer::initialize(0, $this->IDS); break; //Vincula l'usuari del facebook //Vincula l'usuari del facebook case 'FB_LINK': $idU = $this->getUser()->getSessionPar('idU'); $OU = UsuarisPeer::retrieveByPK($idU); $FB_ID = $this->PARS['user']['id']; //Mirem si el número de facebook està associat a un altre usuari. Si és així, no fem res però emetem error. $OUF = UsuarisPeer::getUserFromFacebook($FB_ID); if ($OUF instanceof Usuaris) { $this->ERROR = 'El compte de facebook actual està vinculat a un altre usuari. <br />Si us plau comuniqui-ho a informatica@casadecultura.org o bé entri al seu usuari de facebook i torni-ho a provar.'; } elseif ($OU instanceof Usuaris) { $OU->setFacebookid($this->PARS['user']['id']); $OU->save(); } $this->FBI = UsuarisPeer::getUserFbCode($this->getUser()->getSessionPar('idU')); break; //Desvincula l'usuari del facebook //Desvincula l'usuari del facebook case 'FB_UNLINK': $idU = $this->getUser()->getSessionPar('idU'); $OU = UsuarisPeer::retrieveByPK($idU); $OU->setFacebookid(NULL); $OU->save(); $this->FBI = UsuarisPeer::getUserFbCode($this->getUser()->getSessionPar('idU')); break; //Guardem els canvis a una entitat //Guardem els canvis a una entitat case 'SAVE_SITE': $RS = $request->getParameter('sites'); $this->FENTITAT->bind($RS, $request->getFiles('sites')); if ($this->FENTITAT->isValid()) { $this->FENTITAT->save(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FENTITAT->getObject()); $this->FENTITAT = SitesPeer::initialize($this->IDS); } break; case 'SAVE_DESCOMPTE': //Si entrem un descompte que és 0, vol dir que creem un nou descompte $this->FDESCOMPTE->bind($RDESCOMPTE); if ($this->FDESCOMPTE->isValid()) { $this->FDESCOMPTE->save(); $this->getUser()->addLogAction($this->accio, 'gConfig', $this->FDESCOMPTE->getObject()); $this->FDESCOMPTE = DescomptesPeer::initialize($this->FDESCOMPTE->getObject()->getIddescompte(), $this->IDS); } break; } }
<tr> <td colspan="5">No hem trobat cap resultat amb les dades marcades.</td> </tr> <?php } else { //Agafem el llistat de cursos $LCUR = $LLISTAT_CURSOS; foreach ($LCUR as $OC) { $DATA_INICI = $OC->getDatainici('d') . ' - ' . $OC->getDatainici('m') . ' - ' . $OC->getDatainici('Y'); $CATEGORIA = $OC->getCategoriaText(); $HORARIS = $OC->getHoraris(); $POBLACIO = SitesPeer::getPoblacioSite($OC->getSiteid()); $PREU = $OC->getPreu(); $url = url_for('@hospici_detall_curs?idC=' . $OC->getIdcursos() . '&titol=' . $OC->getNomForUrl()); $NOM = '<a id="link" style="font-size:14px;" href="' . url_for('@hospici_detall_curs?idC=' . $OC->getIdcursos() . '&titol=' . $OC->getNomForUrl()) . '">' . $OC->getTitolcurs() . ' </a><span style="font-size:10px; color:gray;"> (' . $OC->getCodi() . ')</span>'; $ESTAT = myUser::ph_getEtiquetaCursos($AUTH, $OC, $url, $CURSOS_MATRICULATS, $IDU); ?> <tr> <td style="width:80px; vertical-align:top;"><?php echo $DATA_INICI; ?> </td> <td style="vertical-align: top;"><?php echo $NOM; ?> <br /> <span style="color:#63B18E"><?php echo $CATEGORIA; ?>
function formLlistaActivitatsEdicio($OA, $OC, $L_OA_REL, $FA, $IDS) { ?> <div class="REQUADRE fb"> <?php echo include_partial('botonera', array('tipus' => 'Tancar', 'url' => 'gestio/gActivitats?accio=C')); ?> <div class="titol">Editant les activitats ( <?php echo $OC instanceof Cicles ? $OC->getNom() : "No pertany a cap cicle"; ?> )</div> <div id="tabs_cicles"> <ul> <li><a href="#tabs-1">Dades generals</a></li> <li><a href="#tabs-2">Horaris</a></li> <li><a href="#tabs-3">Descripció</a></li> <li><a href="#tabs-4">Activitats del cicle</a></li> </ul> <!-- COMENÇA ACTIVITAT --> <div id="tabs-1"> <div style="padding-top:10px;" class="FORMULARI fb"> <form action="<?php echo url_for('gestio/gActivitats?accio=ACTIVITAT_SAVE'); ?> " method="POST"> <?php echo $FA; ?> <div style="text-align:right; padding-top:40px;"> <button id="B-GUARDA-ACTIVITAT" name="B-GUARDA-ACTIVITAT" type="submit"></button> <button id="B-ESBORRA-ACTIVITAT" name="B-ESBORRA-ACTIVITAT" type="submit"></button> </div> </form> </div> <div style="clear: both;"> </div> </div> <!-- FI ACTIVITAT --> <!-- COMENÇA HORARIS --> <div id="tabs-2"> <div> <?php $A_OH_PREU = $OA->getHorarisAmbPreu(); ?> <?php $L_OH = $OA->getHorariss(); $RET = ""; ?> <?php if (sizeof($L_OH) == 0) { echo '<div class="row_horaris"><div class="col_horaris">Aquesta activitat no té cap horari definit.</div></div>'; } ?> <?php foreach ($L_OH as $OH) { $M = $OH->getArrayHorarisEspaisMaterial(); $HE = $OH->getArrayHorarisEspaisActiusAgrupats(); echo '<div class="row_horaris"> <div class="col_horaris" style="width:100px;">' . myUser::getDiaText($OH->getDia('Y-m-d'), true) . ', ' . $OH->getDia('d/m/Y') . '</div> <div class="col_horaris" style="width:50px;">' . $OH->getHorainici('H:i') . '</div> <div class="col_horaris" style="width:50px;">' . $OH->getHorafi('H:i') . '</div> <div class="col_horaris" style="width:200px;">'; foreach ($HE as $HESPAI) { echo $HESPAI . '<br />'; } echo '</div>'; echo '<div class="col_horaris" style="width:50px; float:right;">'; echo '<a id="H-' . $OH->getHorarisid() . '" class="tt2">' . image_tag('template/door.png') . '<span>Edita l\'horari.</span></a>'; if (array_key_exists($OH->getHorarisid(), $A_OH_PREU)) { echo ' <a id="P-' . $OH->getHorarisid() . '" class="tt2">' . image_tag('template/money.png') . '<span>Edita els preus.</span></a>'; } else { echo ' <a id="P-' . $OH->getHorarisid() . '" class="tt2">' . image_tag('template/money_euro.png') . '<span>Edita els preus.</span></a>'; } echo '</div>'; echo '</div>'; } ?> </div> <br /> <?php echo '<button id="H-0"></button>'; ?> <div id="FORMULARI_HORARI"></div> <div id="FORMULARI_PREU"></div> </div> <!-- FI HORARIS --> <!-- COMENÇA DESCRIPCIÓ --> <div id="tabs-3"> <div style="padding-top:10px;" class="FORMULARI fb"> <form id="FORMULARI_DESCRIPCIO" method="POST"> <?php echo new ActivitatsTextosForm($OA); ?> <?php include_partial('uploads', array('DIRECTORI_WEB' => '/images/activitats/', 'NOM_ARXIU' => 'A-' . $OA->getActivitatid())); ?> <div style="text-align:right; padding-top:40px;"> <input id="B-GUARDA-DESCRIPCIO" name="B-GUARDA-DESCRIPCIO" type="submit" value="Guarda" /> </div> </form> </div> <div style="clear: both;"> </div> </div> <!-- FI DESCRIPCIÓ --> <!-- COMENÇA CICLES --> <div id="tabs-4"> <table class="DADES"> <tr><th>Activitat</th><th>Data</th></tr> <tr><th> </th><th> </th></tr> <?php if (sizeof($L_OA_REL) == 0) { echo '<tr><td class="LINIA">El cicle no té cap activitat.</td></tr>'; } ?> <?php foreach ($L_OA_REL as $OA) { $PrimerDia = $OA->getPrimeraData(); $text = $OA->getTmig(); if (empty($text)) { $text = $OA->getNom(); } echo '<tr> <td class="" width="">' . link_to($text, 'gestio/gActivitats?accio=ACTIVITAT&IDA=' . $OA->getActivitatid()) . '</td> <td class="" width="">' . $PrimerDia . '</td> </tr>'; } ?> </table> <br /> </div> <!-- FI CICLES --> </div> </div> <?php }
?> <?php if (empty($LLISTAT_ACTIVITATS)) { echo '<DIV>Aquest dia no hi ha cap activitat pública.<DIV>'; } foreach ($LLISTAT_ACTIVITATS as $A) { $C = CiclesPeer::retrieveByPK($A->getCiclescicleid()); if ($C instanceof Cicles && $C->getCicleID() > 1) { $nom_cicle = '<b>' . $C->getTMig() . '</b>'; $idC = $C->getCicleID(); } else { $nom_cicle = ""; $idC = 0; } $url_cicle = myUser::text2url($C->getTMig()); $imatge = $A->getImatge(); $pdf = $A->getPdf(); $pdf_cicle = $C->getPdf(); if (!empty($nom_cicle)) { ?> <div style="clear:both;"> <div class="df titol_cicle" style="width:150px;">Activitat del cicle</div> <div class="df titol_cicle" style="color: #A73339; width:330px; padding-left:20px;"><?php echo $nom_cicle; ?> </div> </div> <?php } ?>
/** * Wraps content with a credential condition. * * This overrides the same function in sfAdminGenerator * * @param string $content The content * @param array $params (optional, default = array()) The $array parameters * @param bool $inRow (optional, default = false) * @param bool $useObjects (optional, default = false) * @param string $actionName (optional, default = null) * * @return string HTML code */ public function addCredentialCondition($content, $params = array(), $inRow = false, $useObjects = false, $actionName = null) { if (isset($params['credentials'])) { if ($useObjects) { if ($actionName[0] == '_') { $actionName = substr($actionName, 1); } //check the security for some more configuration if ($actionName) { $objectCredArray = myUser::parseSecurity($this->security, $actionName); if (isset($objectCredArray['key'])) { $class = $objectCredArray['key']['class']; $method = $objectCredArray['key']['method']; //$requestParam = $objectCredArray['request_param']; //$key = "call_user_func(array('$class', '$method'), \$sf_request->getParameter('$requestParam'))"; $key = '$' . $class . '->' . $method . '()'; } else if (isset($objectCredArray['request_param'])) { $requestParam = $objectCredArray['request_param']; $key = "\$sf_request->getParameter('$requestParam')"; } else { //only supports non-segmented keys at the moment $key = $this->getPrimaryKeyIsSet() ; } if (isset($objectCredArray['module'])) { $module = $objectCredArray['module']; } else { $module = $this->moduleName; } $insert = "hasObjectCredential($key, '$module', "; } else { $insert = 'hasCredential('; } } else { $insert = 'hasCredential('; } $credentials = str_replace("\n", ' ', var_export($params['credentials'], true)); if ($inRow) { return <<<EOF [?php if (\$sf_user->$insert $credentials)): ?] $content [?php else: ?] [?php endif; ?] EOF; } else { return <<<EOF [?php if (\$sf_user->$insert $credentials)): ?] $content [?php endif; ?] EOF; } } else { return $content; } }
echo '<td>' . $MATERIAL . '</td>'; echo '</tr>'; } } ?> </table> </div> <div class="REQUADRE"> <div class="TITOL">Novetats</div> <div id="accordion"> <?php foreach (myUser::getLogTimeline($IDU, $IDS) as $id => $A) { $ant = $id; ?> <h1><?php echo ucfirst($id); ?> : <?php echo sizeof($A); ?> </h3> <div> <table width="100%"> <tr><td class="titol">On</td><td class="titol">Quan</td><td class="titol">Qui</td><td class="titol">Què</td><td class="titol">ID</td></tr> <?php
public function setUser(myUser $user_in) { $this->user = $user_in->getAttribute('id'); }
public static function getActivitatsCercaHospici($CER) { $idText = $CER['TEXT']; $idPoble = $CER['POBLE']; $idCategoria = $CER['CATEGORIA']; $idSite = $CER['SITE']; $datai = myUser::revDate($CER['DATAI']); $dataf = myUser::revDate($CER['DATAF']); $p = $CER['P']; $idText = addslashes($idText); $text = !is_null($idText) && !empty($idText) ? " AND (a.tMig like '%{$idText}%' OR a.dMig like '%{$idText}%')" : ""; $poble = !is_null($idPoble) && $idPoble > 0 ? ' AND p.idPoblacio = ' . $idPoble : ''; $categoria = !is_null($idCategoria) && $idCategoria > 0 ? ' AND a.TipusActivitat_idTipusActivitat = ' . $idCategoria : ''; $data = " AND h.Dia >= '" . $datai . "' AND h.Dia <= '" . $dataf . "'"; $site = $idSite > 0 ? " AND s.site_id = {$idSite}" : ""; $connection = Propel::getConnection(); $query = " \r\n Select a.ActivitatID as idA\r\n from activitats a \r\n LEFT JOIN horaris h ON (a.ActivitatID = h.Activitats_ActivitatID )\r\n LEFT JOIN horarisespais he ON (h.HorarisID = he.Horaris_HorarisID)\r\n LEFT JOIN espais e ON (he.Espais_EspaiID = e.EspaiID)\r\n LEFT JOIN sites s ON (a.site_id = s.site_id)\r\n LEFT JOIN poblacions p ON (p.idPoblacio = s.poble) \r\n WHERE \r\n a.actiu = 1 AND h.actiu = 1 AND he.actiu = 1 AND e.actiu = 1 AND s.actiu = 1\r\n AND a.PublicaWEB = 1\r\n {$text}\r\n {$poble}\r\n {$categoria}\r\n {$data}\r\n {$site}\r\n GROUP BY idA\r\n \r\n UNION\r\n Select a.ActivitatID as idA\r\n from activitats a \r\n LEFT JOIN horaris h ON (a.ActivitatID = h.Activitats_ActivitatID )\r\n LEFT JOIN horarisespais he ON (h.HorarisID = he.Horaris_HorarisID)\r\n LEFT JOIN espais_externs ee ON (he.idEspaiextern = ee.idEspaiextern)\r\n LEFT JOIN sites s ON (a.site_id = s.site_id)\r\n LEFT JOIN poblacions p ON (p.idPoblacio = ee.Poble) \r\n WHERE \r\n a.actiu = 1 AND h.actiu = 1 AND he.actiu = 1 AND ee.actiu = 1 AND s.actiu = 1\r\n AND a.PublicaWEB = 1\r\n {$text}\r\n {$poble}\r\n {$categoria}\r\n {$data}\r\n {$site}\r\n GROUP BY idA \r\n "; $statement = $connection->prepare($query); $statement->execute(); $RET = array(); //Guardo els elements resultats i els passo a un format Criteria while ($result = $statement->fetch(PDO::FETCH_ASSOC)) { $RET[$result['idA']] = $result['idA']; } //Ara fem la select dels cursos amb el pager $C = new Criteria(); $C->add(self::ACTIVITATID, $RET, CRITERIA::IN); $C->addJoin(HorarisPeer::ACTIVITATS_ACTIVITATID, self::ACTIVITATID); $C->addAscendingOrderByColumn(self::TIPUSACTIVITAT_IDTIPUSACTIVITAT); $C->addAscendingOrderByColumn(HorarisPeer::DIA); $C->addGroupByColumn(self::ACTIVITATID); $pager = new sfPropelPager('Activitats', 20); $pager->setCriteria($C); $pager->setPage($p); $pager->init(); return array('PAGER' => $pager, 'LACTIVITATS' => $RET); }
<?php if ($MODE == 'LLISTAT_MATRICULES') { echo myUser::mostraMatricules($NOM, $MATRICULES, $OC, $estat, true); } elseif ($MODE == 'LLISTAT_ALUMNES') { echo myUser::mostraMatricules($NOM, $MATRICULES, $OC, $estat, false); }
/** * Get a list of user permissions by action and class of resource * * @param myUser $user - user session * @param string $action - requested ACL action * @param string $class - resource class * * @return QubitQuery list of QubitAclPermissions */ public static function getUserPermissionsByAction($user, $class, $action) { // Get user's groups if ($user->isAuthenticated()) { foreach ($user->listGroups() as $group) { $userGroupIds[] = $group->id; } } else { $userGroupIds = array(QubitAclGroup::ANONYMOUS_ID); } // Find relevant rules $criteria = new Criteria(); $c1 = $criteria->getNewCriterion(QubitAclPermission::ACTION, $action); $c2 = $criteria->getNewCriterion(QubitAclPermission::ACTION, null, Criteria::ISNULL); $c1->addOr($c2); // Find by group/user $c3 = $criteria->getNewCriterion(QubitAclPermission::GROUP_ID, $userGroupIds, Criteria::IN); if ($user->isAuthenticated()) { $c4 = $criteria->getNewCriterion(QubitAclPermission::USER_ID, $user->getUserID()); $c3->addOr($c4); } $c1->addAnd($c3); // Find by object type $criteria->addJoin(QubitAclPermission::OBJECT_ID, QubitObject::ID, Criteria::LEFT_JOIN); $c4 = $criteria->getNewCriterion(QubitAclPermission::OBJECT_ID, null, Criteria::ISNULL); $c5 = $criteria->getNewCriterion(QubitObject::CLASS_NAME, $class); $c4->addOr($c5); // Final conjunction $c1->addAnd($c4); $criteria->add($c1); return QubitAclPermission::get($criteria); }
public function LoadWEB(sfWebRequest $request) { $this->redirect('w/NotFound'); //Carrego els banners i les fotos que mostraré //Si s'entra un menú, carrego el contingut que toca segons el menú //Si el menú és només tÃtol, mostro l'estructura de directoris //Si el menú té contingut, //Si el contingut és automà tic, mostro el contingut automà tic //Si el contingut és manual, mostro el contingut manual //Si s'entra una cerca, carrego les activitats que corresponen a la cerca i marco el calendari els dies //Si s'entra un dia del calendari, cerco les activitats d'aquell dia //Si no es cap, carrego les notÃcies de les últimes activitats... $this->setLayout('layout'); $this->IDS = 1; $this->FOTOS = $this->getFotos(); $this->BANNERS = $this->getBanners(); $this->MENU = NodesPeer::retornaMenu($this->IDS); $this->USUARI = $this->getUser()->getSessionPar('idU', 0); $this->SELECCIONAT = 0; $this->LLISTAT_ACTIVITATS = array(); $this->ACTIVITATS_CALENDARI = array(); $this->MISSATGE = array(); if ($this->getUser()->isAuthenticated()) { $this->TIPUS_MENU = 'ADMIN'; } else { $this->TIPUS_MENU = 'WEB'; } $this->DATACAL = $this->getUser()->ParReqSesForm($request, 'DATACAL', time()); $this->PAGINA = $this->getUser()->ParReqSesForm($request, 'p', 1); //Gestió de menús $idN = $request->getParameter('node', 0); $this->OBERT = $this->gestionaNodes($idN); $this->accio = $request->getParameter('accio'); if ($request->hasParameter('BCERCA_x') || $request->hasParameter('CERCA') || $this->accio == 'c') { $this->CERCA = $this->getUser()->ParReqSesForm($request, 'CERCA', ""); $this->accio = 'c'; } else { $this->CERCA = ""; } //Carreguem els dies en els que hi ha alguna activitat. $this->ACTIVITATS_CALENDARI = ActivitatsPeer::getDiesAmbActivitatsMes($this->DATACAL, $this->IDS); switch ($this->accio) { //Contingut manual case 'mc': $this->NODE = NodesPeer::selectPagina($idN); $this->ACCIO = 'web'; break; //Contingut automà tic de cicles //Contingut automà tic de cicles case 'ac': $this->NODE = NodesPeer::selectPagina($idN); if (!$this->NODE->isNew()) { $cat = $this->NODE->getCategories(); $this->LLISTAT_CICLES = ActivitatsPeer::getCiclesCategoria($this->IDS, $cat); $this->ACCIO = 'llistatCiclesCategoria'; $ACT = ActivitatsPeer::selectCategories($this->IDS, true); $this->TITOL = "Cicles i activitats a \"" . $ACT[$cat] . '"'; $this->CAT = $cat; } $this->NODE = $idN; break; //Contingut automà tic d'activitats d'un cicle //Contingut automà tic d'activitats d'un cicle case 'aca': $this->CAT = $request->getParameter('cat', ''); $this->IDC = $request->getParameter('idc', 1); $this->PAGINA = $request->getParameter('p', 1); $this->NODE = $request->getParameter('NODE', 0); $OC = CiclesPeer::retrieveByPK($this->IDC); $this->TITOL = 'Llistat d\'activitats del cicle ' . $OC->getNom(); $this->LLISTAT_ACTIVITATS = ActivitatsPeer::getActivitatsCicles($this->IDC, $this->IDS, true, $this->PAGINA); $this->ACCIO = 'llistatActivitatsCicleCategoria'; break; //Consulta un cicle //Consulta un cicle case 'cc': $this->CICLE = CiclesPeer::retrieveByPK($request->getParameter('idC')); $this->ACCIO = 'mostra_cicle'; $this->TITOL = $this->CICLE->getNom(); break; //Llistat activitats de cicle //Llistat activitats de cicle case 'ccact': $this->IDC = $request->getParameter('idC'); $this->CICLE = CiclesPeer::retrieveByPK($this->IDC); $this->LLISTAT_ACTIVITATS = CiclesPeer::getActivitatsCicleList($this->IDC, $this->IDS, true); $this->ACCIO = 'mostra_activitats_cicle'; $this->TITOL = "Activitats || " . $this->CICLE->getNom(); break; //Cerca //Cerca case 'c': if ($this->CERCA == 'mensual') { $this->CERCA = ''; $this->TITOL = 'ACTIVITATS DEL MES'; } else { $this->TITOL = 'ACTIVITATS TROBADES AMB LA CERCA "' . $this->CERCA . '"'; } $this->LLISTAT_ACTIVITATS = ActivitatsPeer::getActivitatsCerca($this->CERCA, $this->DATACAL, $this->PAGINA, $this->IDS); $this->ACCIO = 'llistat_activitats_cerca'; $this->MODE = 'CERCA'; break; //Cerca un dia //Cerca un dia case 'ca': $this->LLISTAT_ACTIVITATS = ActivitatsPeer::getActivitatsDia($this->IDS, date('Y-m-d', $this->DATACAL), $this->PAGINA); $this->ACCIO = 'llistat_activitats'; $this->TITOL = 'ACTIVITATS EL DIA ' . date('d/m/Y', $this->DATACAL); $this->MODE = 'DIA'; break; //Mostra una sola activitat //Mostra una sola activitat case 'caa': $this->LLISTAT_ACTIVITATS = array(ActivitatsPeer::retrieveByPK($request->getParameter('idA'))); $this->NODE = $request->getParameter('node', 0); $this->ACCIO = 'mostra_activitat'; $this->TITOL = 'Informació de l\'activitat'; $OA = $this->LLISTAT_ACTIVITATS[0]; $this->getResponse()->addMeta('facebook', myUser::getFacebookHeaders($OA->getTmig(), sfConfig::get('sf_webdomain') . $this->getController()->genUrl('@web_activitat?idA=' . $OA->getActivitatId() . '&titol=' . $OA->getNomForUrl()), OptionsPeer::getString('SF_WEBROOT', 1) . 'images/activitats/' . $OA->getActivitatId() . '.jpg', 'Casa de Cultura de Girona', '1763108168308')); break; //Canvi data del calendari //Canvi data del calendari case 'cdc': $this->redirect('web/index?accio=c&CERCA=mensual&DATACAL=' . $this->DATACAL); break; //Mostrem notÃcies //Mostrem notÃcies default: $this->IDN = $request->getParameter('idN', 0); $this->PAGINA = $request->getParameter('p', 1); if ($this->IDN > 0) { $this->NOTICIA = NoticiesPeer::getNoticia($this->IDN, $this->IDS); $this->getResponse()->addMeta('facebook', myUser::getFacebookHeaders($this->NOTICIA->getTitolnoticia(), sfConfig::get('sf_webdomain') . $this->getController()->genUrl('@web_noticia?idN=' . $this->NOTICIA->getIdnoticia() . '&p=' . $this->PAGINA . '&titol=' . $this->NOTICIA->getNomForUrl()), OptionsPeer::getString('SF_WEBROOT', 1) . 'images/noticies/' . $this->NOTICIA->getIdnoticia() . '.jpg', 'Casa de Cultura de Girona', '1763108168308')); $this->NOTICIES = null; } else { $this->NOTICIA = null; $this->NOTICIES = NoticiesPeer::getNoticies('%', $this->PAGINA, true, FALSE, $this->IDS); } $this->ACCIO = 'noticies'; $this->getUser()->setSessionPar('NODES', array()); break; break; } }
} else { echo '<DIV>Aquest dia no hi ha cap activitat pública.<DIV>'; } } else { echo '<TABLE id="llistat_activitats_dia">'; echo '<tr> <th style="text-align:left">Activitat</th> <th style="text-align:left">Dia</th> <th style="text-align:left">Hora</th> </tr>'; foreach ($LLISTAT_ACTIVITATS->getResults() as $A) { $OA = $A->getActivitats(); $OC = $OA->getCicles(); $nom_act = $OA->getTMig(); $nom_cicle = $OC->getTmig(); $link_cicle = link_to($nom_cicle, '@web_cicle?idC=' . $OC->getCicleid() . '&titol=' . myUser::text2url($nom_cicle)); if (!empty($nom_act)) { echo '<tr>'; echo '<td>'; echo '<a href="' . url_for('@web_activitat?idA=' . $OA->getActivitatid() . '&titol=' . $OA->getNomForUrl()) . '">' . $OA->getTmig() . '</a>'; if ($OC->getCicleid() > 1) { echo ' || Cicle: ' . $link_cicle; } echo '</td>'; echo '<td>' . generaData($A->getDia('Y-m-d')) . '</td>'; echo '<td>' . $A->getHoraInici('H:i') . '</td>'; echo '</tr>'; } } if ($MODE == 'CERCA') { echo '<tr><td colspan="3" style="text-align:center">' . setPager($LLISTAT_ACTIVITATS, 'web/index?accio=c', $PAGINA) . '</td></tr>';
<div class="pdf_cicle" style="margin-top: 5px;"> <div class="requadre_mini" style="background-color: #D4A261;"> <a href="/images/cursos/<?php echo $pdf; ?> ">Baixa't el pdf del curs</a> </div> </div> <?php } ?> <!-- Inici del marcador de curs --> <div style="margin-top: 5px; margin-bottom:5px;"> <?php echo myUser::ph_getEtiquetaCursos($AUTH, $CURS, $url, $CURSOS_MATRICULATS); ?> </div> <!-- Fi del marcador de curs --> <div style="margin-top:20px;"> <?php echo ph_getAddThisDiv(); ?> </div> </div> <div style="width:400px; float:left;"> <div style="padding-left:50px; font-size:10px;">