Exemple #1
0
 /**
  * Build the file path of a textzone in a given context
  *
  * @param string $key
  * @param array $context specify the context to build the path.
  * @param array $right specify an array of right to specify the file
  * @return file path
  */
 public static function get_textzone_file_path($key, $context = null, $right = null)
 {
     $textZoneFile = null;
     $key .= '.';
     if (!is_null($right) && is_array($right)) {
         foreach ($right as $context => $rightInContext) {
             if (is_array($rightInContext)) {
                 $key .= $context . '_';
                 foreach ($rightInContext as $rightName => $rightValue) {
                     if (is_bool($rightValue)) {
                         $key .= $rightValue ? $rightName : 'not_' . $rightName;
                     } else {
                         $key .= $rightName . '_' . $rightValue;
                     }
                     $key .= '.';
                 }
             }
         }
     }
     if (is_array($context) && array_key_exists(CLARO_CONTEXT_COURSE, $context)) {
         if (is_array($context) && array_key_exists(CLARO_CONTEXT_GROUP, $context)) {
             $textZoneFile = get_conf('coursesRepositorySys') . claro_get_course_group_path($context) . '/textzone/' . $key . 'inc.html';
         } else {
             $textZoneFile = get_conf('coursesRepositorySys') . claro_get_course_path($context[CLARO_CONTEXT_COURSE]) . '/textzone/' . $key . 'inc.html';
         }
     }
     if (is_null($textZoneFile)) {
         $textZoneFile = get_path('rootSys') . 'platform/textzone/' . $key . 'inc.html';
     }
     pushClaroMessage($textZoneFile);
     return $textZoneFile;
 }
Exemple #2
0
/**
 * Return the config ropisitory for a given context
 *
 * All platform config are stored in platform/conf/
 * But a course or a group can overide some config values
 *
 * This function return the repository ignoring if it's  existing or empty
 *
 * @param array $context
 * @return string
 */
function claro_get_conf_repository($context = array())
{
    if (!isset($context) || !is_array($context) || empty($context) || is_null($context)) {
        return get_path('rootSys') . 'platform/conf/';
    }
    if (array_key_exists(CLARO_CONTEXT_COURSE, $context)) {
        if (array_key_exists(CLARO_CONTEXT_GROUP, $context)) {
            return claro_get_course_group_path($context) . '/conf/';
        }
        return get_path('coursesRepositorySys') . claro_get_course_path($context[CLARO_CONTEXT_COURSE]) . '/conf/';
    }
    pushClaroMessage('Unknown context passed to claro_get_conf_repository : ' . var_export($context, 1), 'warning');
    return null;
}