Ejemplo n.º 1
0
function HTMLtermMenu($array_tema, $relacionesTermino)
{
    $row .= '[<a tabindex="0" href="#menu-manager" id="hierarchybreadcrumbTermMenu">' . LABEL_Opciones . '</a>]';
    $row .= '<div id="term-menu" class="hidden" style="display: none">';
    $row .= '<ul class="menumanager">';
    $sqlcheckIsValidTerm = SQLcheckIsValidTerm($array_tema[tema_id]);
    //no have relations
    if ($relacionesTermino[cantTotal] == '0') {
        $link_estado = '<li><a title="' . LABEL_EliminarTE . '" href="index.php?id_dete=' . $array_tema[idTema] . '">' . ucfirst(LABEL_EliminarTE) . '</a></li>';
        /*
        Change status term
        */
        $link_estado .= '<li><a href="#">' . ucfirst(LABEL_CambiarEstado) . '</a><ul id="menu_estado">';
        switch ($array_tema[estado_id]) {
            case '12':
                //Candidato / candidate => aceptado
                $link_estado .= '<li><a title="' . LABEL_AceptarTermino . '" href="index.php?tema=' . $array_tema[idTema] . '&amp;estado_id=13">' . ucfirst(LABEL_AceptarTermino) . '</a></li>';
                //Candidato / candidate => rechazado
                $link_estado .= '<li><a title="' . LABEL_RechazarTermino . '" href="index.php?tema=' . $array_tema[idTema] . '&amp;estado_id=14">' . ucfirst(LABEL_RechazarTermino) . '</a></li>';
                break;
            case '13':
                //Aceptado / Acepted=> Rechazado
                $link_estado .= '<li><a title="' . LABEL_RechazarTermino . '" href="index.php?tema=' . $array_tema[idTema] . '&amp;estado_id=14">' . ucfirst(LABEL_RechazarTermino) . '</a></li>';
                break;
            case '14':
                //Rechazado / Rejected=> Candidato
                $link_estado .= '<li><a title="' . LABEL_CandidatearTermino . '" href="index.php?tema=' . $array_tema[idTema] . '&amp;estado_id=12">' . ucfirst(LABEL_CandidatearTermino) . '</a></li>';
                break;
        }
        $link_estado .= '</ul></li>';
    }
    // PERMITIR O NO POLIJERARQUIAS//
    if (($relacionesTermino[cantTG] == 0 || $_SESSION[CFGPolijerarquia] == '1') && $array_tema[estado_id] == '13') {
        $link_subordinar = '<li><a title="' . MENU_AgregarTG . '" href="index.php?taskterm=addBT&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_AgregarTG) . '</a></li>';
    }
    $row .= '      <li><a title="' . MENU_EditT . '" href="index.php?taskterm=editTerm&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_EditT) . '</a></li>';
    //es un término que admite notas y relaciones
    if ($sqlcheckIsValidTerm[cant] == '0') {
        $row .= '     <li><a title="' . LABEL_EditorNota . '" href="index.php?taskterm=editNote&amp;note_id=?&amp;editNota=?&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(LABEL_EditorNota) . '</a></li>';
    }
    $row .= $link_estado;
    //solo acepta relaciones si el término esta aceptado
    if ($array_tema[estado_id] == '13' && $sqlcheckIsValidTerm[cant] == '0') {
        $row .= '<li><a href="#">' . ucfirst(LABEL_Agregar) . '</a><ul id="menu_agregar">';
        //link agregar un TE
        $row .= '     <li><a title="' . MENU_AgregarTE . '" href="index.php?taskterm=addNT&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_AgregarTE) . '</a></li>';
        //link agregar un UP
        $row .= '     <li><a href="index.php?taskterm=addUF&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_AgregarUP) . '</a></li>';
        //link agregar un EQ
        $row .= '     <li><a title="' . LABEL_relacion_vocabulario . '" href="index.php?taskterm=addEQ&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(LABEL_relacion_vocabulario) . '</a></li>';
        //link agregar un término externo vía web services
        $row .= '     <li><a title="' . LABEL_relacion_vocabularioWebService . '" href="index.php?taskterm=findTargetTerm&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(LABEL_relacion_vocabularioWebService) . '</a></li>';
        $row .= '    </ul></li>';
        $row .= '<li><a href="#">' . ucfirst(FORM_LABEL_RelTerminos) . '</a><ul id="menu_agregar_relaciones">';
        //link agregar un TE
        $row .= '    ' . $link_subordinar . '';
        $row .= '     <li><a title="' . MENU_AgregarTEexist . '" href="index.php?taskterm=addFreeNT&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_AgregarTEexist) . '</a></li>';
        //SafetyLit
        //link agregar un UP
        $row .= '     <li><a href="index.php?taskterm=addFreeUF&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_AgregarUPexist) . '</a></li>';
        //SafetyLit
        //link agregar un TR
        $row .= '     <li><a title="' . MENU_AgregarTR . '" href="index.php?taskterm=addRT&amp;tema=' . $array_tema[idTema] . '">' . ucfirst(MENU_AgregarTR) . '</a></li>';
        $row .= '    </ul>
			</li>';
    }
    /*
    		$row.='    </ul></li>';
    */
    $row .= '   </ul>';
    $row .= '</div>';
    return $row;
}
function HTMLtermMenuX2($array_tema, $relacionesTermino)
{
    $sqlcheckIsValidTerm = SQLcheckIsValidTerm($array_tema["tema_id"]);
    $isValidTerm = SQLcount($sqlcheckIsValidTerm) == 0 ? true : false;
    // PERMITIR O NO POLIJERARQUIAS//
    if (($relacionesTermino["cantTG"] == 0 || $_SESSION["CFGPolijerarquia"] == '1') && $array_tema["estado_id"] == '13' && $isValidTerm) {
        $link_subordinar = '<li><a title="' . MENU_AgregarTG . '" href="index.php?taskterm=addBT&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(MENU_AgregarTG) . '</a></li>';
    }
    $row .= '<li><a href="#" class="dropdown-toggle" data-toggle="dropdown">' . ucfirst(LABEL_Opciones) . '<b class="caret"></b></a>';
    $row .= '<ul class="dropdown-menu" role="menu">';
    if ($relacionesTermino["cantNT"] + $relacionesTermino["cantUF"] == 0) {
        //no have relations
        if ($relacionesTermino["cantTotal"] == '0') {
            /*
            Change status term
            */
            $link_estado .= '<li class="dropdown-submenu" role="menu"> <a tabindex="0" label-primary data-toggle="dropdown">' . ucfirst(LABEL_CambiarEstado) . '</a><ul class="dropdown-menu" id="menu_estado">';
            switch ($array_tema["estado_id"]) {
                case '12':
                    //Candidato / candidate => aceptado
                    $link_estado .= '<li><a title="' . LABEL_AceptarTermino . '" href="index.php?tema=' . $array_tema["idTema"] . '&amp;estado_id=13">' . ucfirst(LABEL_AceptarTermino) . '</a></li>';
                    //Candidato / candidate => rechazado
                    $link_estado .= '<li><a title="' . LABEL_RechazarTermino . '" href="index.php?tema=' . $array_tema["idTema"] . '&amp;estado_id=14">' . ucfirst(LABEL_RechazarTermino) . '</a></li>';
                    break;
                case '13':
                    //Aceptado / Acepted=> Rechazado
                    $link_estado .= '<li><a title="' . LABEL_RechazarTermino . '" href="index.php?tema=' . $array_tema["idTema"] . '&amp;estado_id=14">' . ucfirst(LABEL_RechazarTermino) . '</a></li>';
                    break;
                case '14':
                    //Rechazado / Rejected=> Candidato
                    $link_estado .= '<li><a title="' . LABEL_CandidatearTermino . '" href="index.php?tema=' . $array_tema["idTema"] . '&amp;estado_id=12">' . ucfirst(LABEL_CandidatearTermino) . '</a></li>';
                    break;
            }
            $link_estado .= '</ul></li>';
        }
    }
    $row .= '      <li><a title="' . MENU_EditT . '" href="index.php?taskterm=editTerm&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(MENU_EditT) . '</a></li>';
    //If the term are not accepted and do not have Add-menu => add notes options here!
    if ($array_tema["estado_id"] !== "13") {
        $row .= '     <li><a title="' . ucfirst(LABEL_EditorNota) . '" href="index.php?taskterm=editNote&amp;note_id=?&amp;editNota=?&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(LABEL_EditorNota) . '</a></li>';
    }
    $row .= $link_subordinar;
    $row .= $link_estado;
    if ($isValidTerm) {
        if ($array_tema["isMetaTerm"] == 1) {
            $label_task_meta_term = LABEL_turnOffMetaTerm;
            $task_meta_term = 0;
        } else {
            $label_task_meta_term = LABEL_turnOnMetaTerm;
            $task_meta_term = 1;
        }
        $row .= '<li><a title="' . $label_task_meta_term . '" href="index.php?taskterm=metaTerm&amp;mt_status=' . $task_meta_term . '&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst($label_task_meta_term) . '</a></li>';
    }
    $row .= '<li><a class="btn btn-danger" title="' . LABEL_EliminarTE . '" href="javascript:expandLink(\'borrart\')">' . ucfirst(LABEL_EliminarTE) . '</a></li>';
    $row .= '</ul>';
    $row .= '</li><!-- end menu -->';
    //solo acepta relaciones si el término esta aceptado
    if ($array_tema["estado_id"] == '13' && $isValidTerm) {
        $row .= '<li><a href="#" class="dropdown-toggle"  role="menu" data-toggle="dropdown">' . ucfirst(LABEL_Agregar) . '<b class="caret"></b></a>';
        $row .= '<ul class="dropdown-menu" id="menu_agregar">';
        $row .= '     <li><a title="' . ucfirst(LABEL_nota) . '" href="index.php?taskterm=editNote&amp;note_id=?&amp;editNota=?&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(LABEL_nota) . '</a></li>';
        $row .= '<li role="separator" class="divider"></li>';
        //link agregar un TE
        $row .= '     <li><a title="' . MENU_AgregarTE . '" href="index.php?taskterm=addNT&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(MENU_AgregarTE) . '</a></li>';
        //link agregar un UP
        $row .= '     <li><a title="' . MENU_AgregarUP . '" href="index.php?taskterm=addUF&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(MENU_AgregarUP) . '</a></li>';
        //link agregar un TR
        $row .= '     <li><a title="' . MENU_AgregarTR . '" href="index.php?taskterm=addRTnw&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(MENU_AgregarTR) . '</a></li>';
        $row .= '     <li><a title="' . LABEL__getForRecomendation . '" href="index.php?taskterm=findSuggestionTargetTerm&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(LABEL__getForRecomendation) . '</a></li>';
        $row .= '<li role="separator" class="divider"></li>';
        $row .= '     <li><a title="' . LABEL_URI2term . '" href="index.php?taskterm=addURI&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(LABEL_URI2term) . '</a></li>';
        $row .= '<li class="dropdown-submenu">
		<a tabindex="0" data-toggle="dropdown">' . ucfirst(LABEL_relbetweenVocabularies) . '</a>
		<ul class="dropdown-menu" role="menu" id="menu_agregar_relaciones">';
        //link agregar un EQ
        $row .= '     <li><a title="' . LABEL_vocabulario_referencia . '" href="index.php?taskterm=addEQ&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(LABEL_vocabulario_referencia) . '</a></li>';
        //link agregar un término externo vía web services
        $row .= '     <li><a title="' . LABEL_relacion_vocabularioWebService . '" href="index.php?taskterm=findTargetTerm&amp;tema=' . $array_tema["idTema"] . '">' . ucfirst(LABEL_vocabulario_referenciaWS) . '</a></li>';
        $row .= '    </ul>';
        $row .= '</li>';
        $row .= '</ul>';
        $row .= '</li>';
    }
    return $row;
}