/** * Rutea el pedido de uan imagen como si se estubiera ejecutando el proyecto */ static function url_imagen_de_origen($img, $origen) { switch ($origen) { case 'apex': return toba_recurso::imagen_toba($img); break; case 'skin': $estilo = toba::proyecto(toba_editor::get_proyecto_cargado())->get_parametro('estilo'); $proyecto = toba::proyecto(toba_editor::get_proyecto_cargado())->get_parametro('estilo_proyecto'); return toba_recurso::url_skin($estilo, $proyecto) . '/' . $img; break; case 'proyecto': return toba_recurso::url_proyecto(toba_editor::get_proyecto_cargado()) . '/img/' . $img; break; default: throw new toba_error("No esta contemplado el origen {$origen}"); } }
static function link_css($archivo = 'toba', $rol = 'screen', $buscar_en_proyecto = true) { $link = ''; $version = toba::memoria()->get_dato_instancia('toba_revision_recursos_cliente'); $agregado_url = !is_null($version) ? "?av={$version}" : ''; //--- Incluye primero el del nucleo $url = toba_recurso::url_toba() . "/css/{$archivo}.css{$agregado_url}"; $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n"; //--- Incluye el del skin si es el estandar if ($archivo == 'toba') { $url = toba_recurso::url_skin() . "/toba.css{$agregado_url}"; $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n"; } //--- Incluye el del proyecto, si existe if ($buscar_en_proyecto) { $version = toba::memoria()->get_dato_instancia('proyecto_revision_recursos_cliente'); $agregado_url = !is_null($version) ? "?av={$version}" : ''; $proyecto = toba_proyecto::get_id(); $path = toba::instancia()->get_path_proyecto($proyecto) . "/www/css/{$archivo}.css"; if (file_exists($path)) { $url = toba_recurso::url_proyecto($proyecto) . "/css/{$archivo}.css{$agregado_url}"; $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n"; } if (toba::proyecto()->personalizacion_activa()) { $www = toba::proyecto()->get_www_pers("css/{$archivo}.css"); if (file_exists($www['path'])) { $url = $www['url'] . $agregado_url; $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n"; } } $path = toba::instancia()->get_path_proyecto($proyecto) . "/www/css/" . $archivo . "_hack_ie.css"; if (file_exists($path)) { $url = toba_recurso::url_proyecto($proyecto) . "/css/" . $archivo . "_hack_ie.css"; $link .= "<!--[if lt IE 8]>\n"; $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n\n"; $link .= "<![endif]-->\n"; } } return $link; }