コード例 #1
0
 public static function getTablaFicheros()
 {
     $c = TablaPeer::getCriterioAlcance();
     $id_empresa = sfContext::getInstance()->getUser()->getAttribute('idempresa', 0);
     $c->addAnd(TablaPeer::ID_EMPRESA, $id_empresa, Criteria::EQUAL);
     $c->addAnd(TablaPeer::ES_FICHEROS, true, Criteria::EQUAL);
     $t = TablaPeer::doSelectOne($c);
     if ($t instanceof Tabla) {
         return $t->getIdTabla();
     } else {
         return 0;
     }
 }
コード例 #2
0
ファイル: Empresa.php プロジェクト: Esleelkartea/legedia-ESLE
 public function getCamposFormularioOrdenadosAlcancetablas($id_tabla = null, $solo_en_lista = false)
 {
     $c = new Criteria();
     $c->addJoin(CampoPeer::ID_CAMPO, RelCampoTablaPeer::ID_CAMPO, Criteria::JOIN);
     $c->addJoin(RelCampoTablaPeer::ID_TABLA, TablaPeer::ID_TABLA, Criteria::JOIN);
     $c->addAnd(TablaPeer::ID_EMPRESA, $this->getIdEmpresa(), Criteria::EQUAL);
     //$c->addAnd(CampoPeer::ES_GENERAL , true);
     $c->addAscendingOrderByColumn(CampoPeer::ORDEN);
     $c->setDistinct();
     $campos = CampoPeer::doSelect($c);
     //el siguiente ódigo es bastante ineficiente. Podría conseguirse una SQL que obtuviera todos los campos accesibles de la promotra
     $tablaes = TablaPeer::doSelect(TablaPeer::getCriterioAlcance());
     $accesible = array();
     foreach ($tablaes as $tab) {
         $accesible[$tab->getIdTabla()] = 1;
     }
     if ($id_tabla != null) {
         if (isset($accesible[$id_tabla])) {
             //Si viene que solo queremos los datos de una tabla y esta es accesible => solo obtenemos los campos de esa tabla.
             unset($accesible);
             $accesible[$id_tabla] = 1;
         } else {
             //la tabla no es accesible => devolver que no tiene campos
             return array();
         }
     }
     $resultado = array();
     foreach ($campos as $campo) {
         if (!$campo->getEsGeneral()) {
             $rels = $campo->getRelCampoTablas();
             //print_r($rels);
             foreach ($rels as $rel) {
                 if (isset($accesible[$rel->getIdTabla()])) {
                     if ($solo_en_lista) {
                         if ($campo->getEnLista()) {
                             $resultado[] = $campo;
                         }
                     } else {
                         $resultado[] = $campo;
                     }
                     break;
                     //sale del if o del for?
                 }
             }
         } else {
             $resultado[] = $campo;
         }
     }
     return $resultado;
 }
コード例 #3
0
?>
</h2>
<div class="form-row">
  <?php 
echo label_for('campo[id_empresa]', __($labels['campo{id_empresa}']), '');
?>
  <div class="content">
  <?php 
echo $empresa ? link_to($empresa->__toString() ? $empresa->__toString() : '-', 'empresas/show?id_empresa=' . $empresa->getPrimaryKey()) : '-';
?>
  </div>
</div>
<?php 
if (isset($id_tabla)) {
    ?>
<div class="form-row">
  <?php 
    echo label_for('campo[id_tabla]', __($labels['campo{id_tabla}']), '');
    ?>
  <div class="content">
  <?php 
    $tabla = TablaPeer::retrievebypk($id_tabla);
    echo $tabla ? link_to($tabla->__toString() ? $tabla->__toString() : '-', 'tablas/show?id_tabla=' . $tabla->getPrimaryKey()) : '-';
    ?>
  </div>
</div>
<?php 
}
?>
</fieldset>
コード例 #4
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 = TablaPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdTabla($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdUsuario($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setIdEmpresa($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setNombre($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setImagen($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setMostrarEnLista($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setOrden($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setEsFicheros($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setIdCategoria($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setCreatedAt($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setUpdatedAt($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setBorrado($arr[$keys[11]]);
     }
 }
コード例 #5
0
 /**
  * Get the associated Tabla object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Tabla The associated Tabla object.
  * @throws     PropelException
  */
 public function getTabla(PropelPDO $con = null)
 {
     if ($this->aTabla === null && $this->id_tabla !== null) {
         $c = new Criteria(TablaPeer::DATABASE_NAME);
         $c->add(TablaPeer::ID_TABLA, $this->id_tabla);
         $this->aTabla = TablaPeer::doSelectOne($c, $con);
         /* 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->aTabla->addAlcances($this);
         		 */
     }
     return $this->aTabla;
 }
コード例 #6
0
 public static function getCampoCodAgencia()
 {
     $c = TablaPeer::getCriterioAlcance();
     $id_empresa = sfContext::getInstance()->getUser()->getAttribute('idempresa', 0);
     $c->AddJoin(CampoPeer::ID_CAMPO, RelCampoTablaPeer::ID_CAMPO, Criteria::JOIN);
     $c->AddJoin(RelCampoTablaPeer::ID_TABLA, TablaPeer::ID_TABLA, Criteria::JOIN);
     $c->addAnd(TablaPeer::ID_EMPRESA, $id_empresa, Criteria::EQUAL);
     $c->addAnd(TablaPeer::ES_FICHEROS, true, Criteria::EQUAL);
     $c->addAnd(CampoPeer::ES_COD_AGENCIA, true, Criteria::EQUAL);
     $campo = CampoPeer::doSelectOne($c);
     if ($campo instanceof Campo) {
         return $campo->getIdCampo();
     } else {
         return 0;
     }
 }
コード例 #7
0
 public function executeUpdate_select_tablas2()
 {
     $include_blank = $this->getRequestParameter('include_blank') == 'true' ? true : false;
     $c = $this->getCriterio();
     $id_empresa = $this->getRequestParameter('id_empresa');
     $empresa = null;
     if ($id_empresa) {
         $c->addAnd(EmpresaPeer::ID_EMPRESA, $id_empresa);
         $empresa = EmpresaPeer::doSelectOne($c);
         $this->forward404Unless($empresa);
     }
     $c1 = TablaPeer::getCriterioAlcance();
     if ($empresa instanceof Empresa) {
         $this->tablas = $empresa->getTablas($c1);
     } else {
         $this->tablas = TablaPeer::doSelect($c1);
     }
     //$this->control_name = $this->getRequestParameter('control_name' , 'tabla[id_tabla]');
     //$this->include_blank = $include_blank;// ? true : false;
 }
コード例 #8
0
<?php

use_helper('Text');
use_helper('Date');
use_helper('I18N');
?>

<?php 
$usuario = Usuario::getUsuarioActual();
?>

<?php 
$id_empresa_sel = sfContext::getInstance()->getUser()->getAttribute('idempresa', null);
$c = TablaPeer::getCriterioAlcance(true);
$c->add(TablaPeer::ID_EMPRESA, $id_empresa_sel);
$tablas = TablaPeer::doSelect($c);
?>

<div id="sf_admin_content" style="width:100%;">
<div class="grid2col" style="width: 100%; position: relative; top: -90px">
  <div class="column first" style="width: 35%; padding-top: 120px; border-right: 1px solid grey;">
    <div>

        <?php 
include_partial('mensajes', array('pager' => $mensajes, 'labels' => $labels));
?>
      
        <div style="clear:both"><!-- ie bugfix --></div>

        <div style="width: 95%; border-bottom: 1px dotted black; font-weight: bold; font-size: 15px;">
        <?php 
コード例 #9
0
 form-error<?php 
    }
    ?>
">
  <?php 
    if ($sf_request->hasError('campo{valor_defecto}')) {
        ?>
    <?php 
        echo form_error('campo{valor_defecto}', array('class' => 'form-error-msg'));
        ?>
  <?php 
    }
    ?>
  <?php 
    //Obtener el campo de la tabla que es el nombre
    $mitabla = TablaPeer::retrieveByPk($campo->getValorTabla());
    if ($mitabla != null) {
        //$formularios = $mitabla->getFormularios(FormularioPeer::getCriterioAlcance());
        //$value = select_tag("campo[defecto_tabla]" , objects_for_select($formularios , 'getPrimaryKey' , '__toString' , $campo->getDefecto(), array('include_blank' => true)) ,
        //array('control_name' => "campo[defecto_tabla]"));
        if ($campo->getDefecto() != 0) {
            $formulario_t = FormularioPeer::retrieveByPk($campo->getDefecto());
        } else {
            $formulario_t = new Formulario();
        }
        $value = popUp("campo[defecto_tabla]", $formulario_t, $mitabla->getIdEmpresa(), $campo->getValorTabla());
    }
    echo $value ? $value : '&nbsp;';
    ?>
  <div class="sf_edit_help"><?php 
    echo __('Indique el valor por defecto del campo');
コード例 #10
0
 /**
  * Selects a collection of Formulario objects pre-filled with all related objects except UsuarioRelatedByIdUsuarioCreador.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Formulario objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUsuarioRelatedByIdUsuarioCreador(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     FormularioPeer::addSelectColumns($c);
     $startcol2 = FormularioPeer::NUM_COLUMNS - FormularioPeer::NUM_LAZY_LOAD_COLUMNS;
     TablaPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (TablaPeer::NUM_COLUMNS - TablaPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(FormularioPeer::ID_TABLA), array(TablaPeer::ID_TABLA), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = FormularioPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = FormularioPeer::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 {
             $omClass = FormularioPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             FormularioPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Tabla rows
         $key2 = TablaPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = TablaPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = TablaPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 TablaPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Formulario) to the collection in $obj2 (Tabla)
             $obj2->addFormulario($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
コード例 #11
0
?>
" class="reset cump" />
                </td>
            </tr>
        </table>
    </fieldset>-->

<?php 
include_partial('edit_actions', array('formulario' => $formulario, 'id_tabla_proviene' => $id_tabla_proviene, 'id_formulario_proviene' => $id_formulario_proviene));
?>
</form>

<?php 
if (sizeof($tablas_auxiliares) > 0) {
    foreach ($tablas_auxiliares as $tablas_auxiliar) {
        $tabla = TablaPeer::retrievebypk($tablas_auxiliar['id_tabla']);
        ?>
<fieldset id="sf_fieldset_formulario" class="quitar_borde">
<?php 
        /*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
        $ruta = UsuarioPeer::getRuta();
        ?>
<h2><a href="<?php 
        echo $ruta;
        ?>
/formularios/list?filters[id_empresa]=<?php 
        echo $tabla->getIdEmpresa();
        ?>
&filters[id_tabla]=<?php 
        echo $tabla->getIdTabla();
        ?>
コード例 #12
0
 /**
  * It loads file YAML and it assigns the configuration to its respective variables
  * 
  * @access private
  * @param  string $name name of the file YAML
  * @return void
  */
 private function loadAndAssignConfig($name)
 {
     $yf = sfYaml::load(sfConfig::get('sf_csstabs_config_tabs') . $this->recognizeFile($name));
     $yf = $yf['cssTabs'];
     // recuperando la configuración principal
     $this->configTabs = $yf['configTabs'];
     // comprobando si existen pestañas
     if (!empty($yf['mainTabs'][0]['label'])) {
         $this->mainTabs = $yf['mainTabs'];
     }
     //CESAR=> COGEMOS EL CAMPO "REGISTROS" y LO SUBTITUIMOS POR LA LISTA DE TABLAS
     $tmp_mainTabs = array();
     foreach ($this->mainTabs as $tab) {
         if (trim(strtolower($tab['module'])) != "formularios") {
             $tmp_mainTabs[] = $tab;
         } else {
             $id_empresa_sel = sfContext::getInstance()->getUser()->getAttribute('idempresa', null);
             $c = TablaPeer::getCriterioAlcance(true);
             $c->add(TablaPeer::ID_EMPRESA, $id_empresa_sel);
             $tablas = TablaPeer::doSelect($c);
             foreach ($tablas as $tabla) {
                 $l_option = array('label' => strtoupper($tabla->getNombre()), 'otra_fila' => true, 'id_tabla' => $tabla->getIdTabla(), 'link' => true, 'module' => 'formularios', 'action' => 'list/?filters[id_empresa]=' . $id_empresa_sel . '&filters[id_tabla]=' . $tabla->getIdTabla() . '&filter=filter', 'tipo' => 0, 'linkOptions' => array());
                 $tmp_mainTabs[] = $l_option;
             }
         }
     }
     $this->mainTabs = $tmp_mainTabs;
     //CESAR=>
     // sub tabs
     if (!empty($yf['subTabs'][0]['label'])) {
         $this->setSubTabs($yf['subTabs']);
     }
 }
コード例 #13
0
    ?>
 form-error<?php 
}
?>
">
  <?php 
if ($sf_request->hasError('alcance{id_tabla}')) {
    ?>
    <?php 
    echo form_error('alcance{id_tabla}', array('class' => 'form-error-msg'));
    ?>
  <?php 
}
?>
  
  <?php 
$c_tabla = TablaPeer::getCriterioAlcance();
$c_tabla->addAscendingOrderBycolumn(TablaPeer::ID_EMPRESA);
if ($alcance->getIdEmpresa()) {
    $c_tabla->add(TablaPeer::ID_EMPRESA, $alcance->getIdEmpresa());
}
$tablaes = TablaPeer::doSelect($c_tabla);
?>

  <?php 
$value = select_tag('alcance[id_tabla]', objects_for_select($tablaes, 'getIdTabla', 'getNombreyEmpresa', $alcance->getIdTabla(), array('include_custom' => " - " . __('Todas') . " - ")), array('control_name' => 'alcance[id_tabla]'));
echo $value ? $value : '&nbsp;';
?>
    </div>
</div>
コード例 #14
0
 /**
  * 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(TablaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(TablaPeer::DATABASE_NAME);
         $criteria->add(TablaPeer::ID_TABLA, $pks, Criteria::IN);
         $objs = TablaPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #15
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Usuario is new, it will return
  * an empty collection; or if this Usuario has previously
  * been saved, it will retrieve related Tablas from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Usuario.
  */
 public function getTablasJoinParametro($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(UsuarioPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collTablas === null) {
         if ($this->isNew()) {
             $this->collTablas = array();
         } else {
             $criteria->add(TablaPeer::ID_USUARIO, $this->id_usuario);
             $this->collTablas = TablaPeer::doSelectJoinParametro($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(TablaPeer::ID_USUARIO, $this->id_usuario);
         if (!isset($this->lastTablaCriteria) || !$this->lastTablaCriteria->equals($criteria)) {
             $this->collTablas = TablaPeer::doSelectJoinParametro($criteria, $con, $join_behavior);
         }
     }
     $this->lastTablaCriteria = $criteria;
     return $this->collTablas;
 }
コード例 #16
0
 protected function getCriterio()
 {
     $c = TablaPeer::getCriterioAlcance();
     return $c;
 }
コード例 #17
0
 protected function getCriterioTabla()
 {
     return TablaPeer::getCriterioAlcance();
 }
コード例 #18
0
<div id="sf_admin_container">

<h1>
    <?php 
if (!isset($id_tabla)) {
    $id_tabla = null;
}
$tabla = TablaPeer::retrieveByPk($id_tabla);
?>
    <?php 
echo __('Editar modelo de campos', array());
?>
    <?php 
if (isset($tabla)) {
    ?>
 de la tabla "<?php 
    echo $tabla->getNombre();
    ?>
"<?php 
}
?>
</h1>

<div id="sf_admin_header">
</div>

<div id="sf_admin_content">
<?php 
if (!sizeof($campos)) {
    ?>
<blockquote class="warning"><p>
コード例 #19
0
function _jscookmenu($arr, $name, $orientation, $theme)
{
    $arr2 = array();
    $id_empresa_sel = sfContext::getInstance()->getUser()->getAttribute('idempresa', null);
    $categorias = ParametroPeer::getCategorias();
    foreach ($categorias as $cat) {
        $tmp_array = array();
        $tmp_array["title"] = strtoupper($cat->getNombre());
        $c = TablaPeer::getCriterioAlcance(true);
        $c->addAnd(TablaPeer::ID_EMPRESA, $id_empresa_sel, Criteria::EQUAL);
        $c->addAnd(TablaPeer::ID_CATEGORIA, $cat->getIdParametro(), Criteria::EQUAL);
        $tablas = TablaPeer::doSelect($c);
        $cont = 1;
        if (sizeof($tablas) > 0) {
            $tmp_array["submenu"] = array();
        }
        foreach ($tablas as $tabla) {
            $tmp_array["submenu"]["menu0" . $cat->getIdParametro() . "." . $cont] = array("title" => $tabla->getNombre(), "url" => 'formularios/list', "after_url" => '/?filters[id_empresa]=' . $id_empresa_sel . '&filters[id_tabla]=' . $tabla->getIdTabla() . '&filter=filter');
            $cont++;
        }
        if (sizeof($tablas) > 0) {
            $arr2["menu0" . $cat->getIdParametro()] = $tmp_array;
        }
    }
    foreach ($arr as $key => $ar) {
        $arr2[$key] = $ar;
    }
    $arr = $arr2;
    _load_jscookmenu_resources($theme);
    $sf_user = sfContext::getInstance()->getUser();
    $js = "var {$name} = [";
    foreach ($arr as $item) {
        if (is_array($item)) {
            // check credentials
            $display = true;
            //if (isset($item['credentials']))
            // $display = $sf_user->hasCredential($item['credentials']);
            if (isset($item['url'])) {
                $actions = explode("/", $item['url']);
                if (!isset($actions[1])) {
                    $actions[1] = "index";
                }
                $display = Usuario::tienePermisos($actions[0], $actions[1]);
            }
            // if sf_user has credentials, display the menu item
            if ($display) {
                $js .= "[" . _get_item($item);
                if (isset($item['submenu'])) {
                    foreach ($item['submenu'] as $subitem) {
                        if (is_array($subitem)) {
                            // check credentials
                            $display = true;
                            if (isset($subitem['url'])) {
                                $actions = explode("/", $subitem['url']);
                                if (!isset($actions[1])) {
                                    $actions[1] = "index";
                                }
                                $display = Usuario::tienePermisos($actions[0], $actions[1]);
                            }
                            //if (isset($subitem['credentials']))
                            //$display = $sf_user->hasCredential($subitem['credentials']);
                            // if sf_user has credentials, display the menu item
                            if ($display) {
                                $js .= ", [" . _get_item($subitem);
                                if (isset($subitem['submenu'])) {
                                    foreach ($subitem['submenu'] as $subsubitem) {
                                        if (is_array($subsubitem)) {
                                            // check credentials
                                            $display = true;
                                            if (isset($subsubitem['url'])) {
                                                $actions = explode("/", $subsubitem['url']);
                                                if (!isset($actions[1])) {
                                                    $actions[1] = "index";
                                                }
                                                $display = Usuario::tienePermisos($actions[0], $actions[1]);
                                            }
                                            //if (isset($subsubitem['credentials']))
                                            //$display = $sf_user->hasCredential($subsubitem['credentials']);
                                            // if sf_user has credentials, display the menu item
                                            if ($display) {
                                                $js .= ", [" . _get_item($subsubitem) . "]";
                                            }
                                        } else {
                                            if ($subsubitem == '_cmSplit') {
                                                $js .= ", " . $subsubitem;
                                            }
                                        }
                                    }
                                }
                                $js .= "]";
                            }
                        } else {
                            if ($subitem == '_cmSplit') {
                                $js .= ', ' . $subitem;
                            }
                        }
                    }
                }
                $js .= "], ";
            }
        } else {
            if ($item == '_cmSplit') {
                $js .= $item . ', ';
            }
        }
    }
    $js = substr($js, 0, strlen($js) - 2);
    $js .= "];";
    $html = tag('div', array('id' => "{$name}"), true);
    $html .= tag('/div', array(), true);
    $js2 = "cmDraw('{$name}', {$name}, '{$orientation}', {$theme});";
    return javascript_tag($js) . $html . javascript_tag($js2);
}