public static function getMenusUsuarisOptions($idU, $idS)
 {
     $RET = "";
     $C = new Criteria();
     $C->add(GestioMenusPeer::ACTIU, true);
     $TOTS = GestioMenusPeer::doSelect($C);
     $C = new Criteria();
     $C->add(self::USUARI_ID, $idU);
     $C->add(self::ACTIU, true);
     $C->add(self::SITE_ID, $idS);
     $PART = UsuarisMenusPeer::doSelect($C);
     foreach ($TOTS as $OM) {
         $exist = false;
         foreach ($PART as $OUM) {
             $exist = $OM->getMenuId() == $OUM->getMenuId() || $exist;
         }
         if (!$exist) {
             $RET .= '<option id="' . $OM->getMenuId() . '" value="' . $OM->getMenuId() . '">' . addslashes($OM->getTitol()) . '</option>';
         } else {
             $RET .= '<option selected id="' . $OM->getMenuId() . '" value="' . $OM->getMenuId() . '">' . addslashes($OM->getTitol()) . '</option>';
         }
     }
     return $RET;
 }
示例#2
0
文件: gestio.php 项目: nagiro/intra
echo image_tag('intranet/logoCCG.png', array('class' => 'IMG_FOTO'));
?>
</TD><TD class="FOTOS"><?php 
echo image_tag('intranet/logoCCG.png', array('class' => 'IMG_FOTO'));
?>
</TD><TD class="FOTOS"><?php 
echo image_tag('intranet/logoCCG.png', array('class' => 'IMG_FOTO'));
?>
</TD></TR> -->
    <TR>    
      <TD class="MENU">
      
      <?php 
if ($sf_user->getSessionPar('idU') > 0) {
    //Carreguem els menús que podrà veure l'usuari
    $LOM = GestioMenusPeer::getMenusUsuari($sf_user->getSessionPar('idU'), $sf_user->getSessionPar('idS'), $sf_user->getSessionPar('idN'));
    $ANT = "";
    echo '<CENTER><TABLE class="MENU_TABLE">';
    foreach ($LOM as $OM) {
        if ($ANT != $OM->getCategoria()) {
            echo '<TR><TD class="SUBMENU_1">' . imgSub1() . ' ' . $OM->getCategoria() . '</TD></TR>';
            $ANT = $OM->getCategoria();
        }
        echo '<TR><TD class="SUBMENU_2">' . link_to(imgSub2() . ' ' . $OM->getTitol(), $OM->getUrl()) . '</TD></TR>';
    }
    echo '</TABLE></CENTER>';
}
?>
      			                  
      </TD>      
    
示例#3
0
 /**
  * Selects a collection of UsuarisMenus objects pre-filled with all related objects except Nivells.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of UsuarisMenus objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptNivells(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     UsuarisMenusPeer::addSelectColumns($criteria);
     $startcol2 = UsuarisMenusPeer::NUM_COLUMNS - UsuarisMenusPeer::NUM_LAZY_LOAD_COLUMNS;
     UsuarisPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (UsuarisPeer::NUM_COLUMNS - UsuarisPeer::NUM_LAZY_LOAD_COLUMNS);
     GestioMenusPeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + (GestioMenusPeer::NUM_COLUMNS - GestioMenusPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(UsuarisMenusPeer::USUARI_ID, UsuarisPeer::USUARIID, $join_behavior);
     $criteria->addJoin(UsuarisMenusPeer::MENU_ID, GestioMenusPeer::MENU_ID, $join_behavior);
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
         call_user_func($sf_hook, 'BaseUsuarisMenusPeer', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = UsuarisMenusPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = UsuarisMenusPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = UsuarisMenusPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             UsuarisMenusPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Usuaris rows
         $key2 = UsuarisPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = UsuarisPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = UsuarisPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 UsuarisPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (UsuarisMenus) to the collection in $obj2 (Usuaris)
             $obj2->addUsuarisMenus($obj1);
         }
         // if joined row is not null
         // Add objects for joined GestioMenus rows
         $key3 = GestioMenusPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = GestioMenusPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = GestioMenusPeer::getOMClass(false);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 GestioMenusPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (UsuarisMenus) to the collection in $obj3 (GestioMenus)
             $obj3->addUsuarisMenus($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(GestioMenusPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(GestioMenusPeer::DATABASE_NAME);
         $criteria->add(GestioMenusPeer::MENU_ID, $pks, Criteria::IN);
         $objs = GestioMenusPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Get the associated GestioMenus object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     GestioMenus The associated GestioMenus object.
  * @throws     PropelException
  */
 public function getGestioMenus(PropelPDO $con = null)
 {
     if ($this->aGestioMenus === null && $this->menu_id !== null) {
         $this->aGestioMenus = GestioMenusPeer::retrieveByPk($this->menu_id);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aGestioMenus->addUsuarisMenuss($this);
         		 */
     }
     return $this->aGestioMenus;
 }
示例#6
0
 public function executeGConfigSuperAdmin(sfWebRequest $request)
 {
     $this->setLayout('gestio');
     $this->IDS = $this->getUser()->getSessionPar('idS');
     $this->accio = $request->getParameter('accio', 'C');
     $RSITES = $request->getParameter('sites', array('site_id' => 1));
     $this->FSITES = SitesPeer::initialize($RSITES['site_id']);
     $this->SITE = $request->getParameter('SITE', '');
     if ($request->hasParameter('BSAVESITE')) {
         $this->accio = 'SAVE_SITE';
     }
     if ($request->hasParameter('BDELETESITE')) {
         $this->accio = 'DELETE_SITE';
     }
     if ($request->hasParameter('BSAVEUSERSITE')) {
         $this->accio = 'SAVE_USER_SITE';
     }
     if ($request->hasParameter('BDELETEUSERSITE')) {
         $this->accio = 'DELETE_USER_SITE';
     }
     if ($request->hasParameter('BSEARCHUSERSITES')) {
         $this->accio = 'SEARCH_USER_SITES';
     }
     if ($request->hasParameter('BSAVEUSERMENU')) {
         $this->accio = 'SAVE_USER_MENU';
     }
     switch ($this->accio) {
         case 'SAVE_SITE':
             $this->FSITES->bind($RSITES);
             if ($this->FSITES->isValid()) {
                 $this->FSITES->save();
                 $this->getUser()->addLogAction($this->accio, 'gConfigSuperAdmin', $this->FSITES->getObject());
                 $this->FSITES = SitesPeer::initialize($this->FSITES->getObject()->getSiteId());
             }
             break;
         case 'DELETE_SITE':
             $this->FSITES->getObject()->setActiu(false)->save();
             $this->getUser()->addLogAction($this->accio, 'gConfigSuperAdmin', $this->FSITES->getObject());
             $this->FESPAIS = SitesPeer::initialize(0, $this->IDS);
             break;
         case 'SAVE_USER_SITE':
             $RP = $request->getParameter('dades');
             foreach ($RP as $RS) {
                 if ($RS['IDU'] > 0 && $RS['IDN'] > 0 && $this->SITE > 0) {
                     $OUS = UsuarisSitesPeer::initialize($RS['IDU'], $this->SITE, false)->getObject();
                     $OUS->setNivellId($RS['IDN']);
                     $OUS->setActiu(true);
                     $OUS->save();
                 }
             }
             $this->LUSERSITES = UsuarisSitesPeer::getSitesUsers($this->SITE, true);
             break;
         case 'DELETE_USER_SITE':
             $USUARI = $request->getParameter('USUARI');
             $SITE = $request->getParameter('SITE');
             $OUS = UsuarisSitesPeer::initialize($USUARI, $SITE)->getObject();
             if (!$OUS->isNew()) {
                 $OUS->setActiu(false);
                 $OUS->save();
                 $this->LUSERSITES = UsuarisSitesPeer::getUserSites($this->SITE);
             }
             break;
         case 'SAVE_USER_MENU':
             $IDS = $request->getParameter('MENU_SITES');
             $IDU = $request->getParameter('MENU_USUARIS');
             $LMENUS = $request->getParameter('MENU_DISPONIBLES');
             if (!empty($LMENUS)) {
                 UsuarisMenusPeer::doUpdateMy($IDU[0], $IDS[0], $LMENUS);
             }
             break;
         case 'SEARCH_USER_SITES':
             $IDS = $this->FMENUUSUARI->getValue('IDS');
             $IDU = $this->FMENUUSUARI->getValue('IDU');
             if (!empty($IDS)) {
                 $this->FMENUUSUARI->setWidgetUsers();
                 if (!empty($IDU)) {
                     $this->LMENUSUSUARI = GestioMenusPeer::getMenusUsuariArray($IDU, $IDS);
                 }
             }
             break;
         default:
             break;
     }
     //Cerquem per SITE, que és més fàcil
     //Mirem quins usuaris hi ha a un SITE relacionats com a adminstradors
     //Mirem quins menús tenen els usuaris d'un SITE en general (els menús del primer usuari)
     $OS = SitesPeer::retrieveByPK($this->SITE);
     if ($OS instanceof Sites) {
         $this->LUSERSITES = UsuarisSitesPeer::getSitesUsers($this->SITE, true);
         $this->LMENUSUSUARI = GestioMenusPeer::getMenusUsuariArray($this->USUARI, $this->SITE);
     } else {
         $this->USUARI = 0;
         $this->LUSERSITES = array();
         $this->LMENUSUSUARI = array();
     }
     $this->FMENUUSUARI = new ConfigSuperAdminMenusForm(null, array('IDS' => $this->IDS));
     $this->FMENUUSUARI->bind($request->getParameter('super_admin_menus'));
 }
示例#7
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = GestioMenusPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setMenuId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setTitol($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setUrl($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCategoria($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setOrdre($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setActiu($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setTipus($arr[$keys[6]]);
     }
 }
示例#8
0
/**
 * Menus Gestió Tab
 * */
function MenusgestioTab($LMENUS = "", $FMENUUSUARI)
{
    $RET = '
            <form id="FMENUS" action="' . url_for('gestio/gConfigSuperAdmin') . '" method="POST" enctype="multipart/form-data">
            <table>' . $FMENUUSUARI . '</table>';
    $RET .= '<br /><br /><table>';
    $RET .= '<tr><td class="titol">Menu</td><td class="titol"></td></tr>';
    $RET .= '<tr><td>' . select_tag('dades', options_for_select(GestioMenusPeer::getSelect(), $LMENUS), array('multiple' => true)) . '</td>';
    $RET .= '</table>';
    $RET .= '         	 	                                                    
                <div style="text-align:right">
                    <button style="margin-top:10px;" name="BSEARCHUSERSITES" class="BOTO_ACTIVITAT">
                        ' . image_tag('template/find.png') . ' Consulta
                    </BUTTON>                       
                    <button type="submit" name="BSAVEUSERMENU" class="BOTO_ACTIVITAT" onClick="return confirm(\'Segur que vols guardar els canvis?\')">
                        ' . image_tag('template/disk.png') . ' Guardar i sortir
                    </button>    	            
                </div>                                                                                            
            </form>';
    return $RET;
}