Пример #1
0
$i = 0;
if (count($objects) > 0) {
    foreach ($objects as $object) {
        if (!empty($object['permissions'])) {
            $object['permissions'] = unserialize($object['permissions']);
        }
        // If viewer does not have permission to view this kind of object, skip it
        if (!$foowd->hasPermission(getClassName($object['classid']), 'view', 'OBJECT', $object['permissions'])) {
            continue;
        }
        $list_objects[$i] = $object;
        $uri_arr['objectid'] = $object['objectid'];
        $uri_arr['classid'] = $object['classid'];
        $list_objects[$i]['url'] = getURI($uri_arr);
        if ($object['workspaceid'] != 0) {
            $list_objects[$i]['langid'] = smdoc_translation::getLink($foowd, $object['workspaceid']);
        } else {
            $list_objects[$i]['langid'] = ' ';
        }
        $list_objects[$i]['updated'] = date(DATETIME_FORMAT, strtotime($object['updated']));
        $list_objects[$i]['desc'] = getClassDescription($object['classid']);
        $i++;
    }
}
$foowd->template->assign('title', _("Site Index"));
$foowd->template->assign('method', '');
$foowd->template->assign_by_ref('objectList', $list_objects);
$foowd->template->assign('body_template', 'smdoc_external.siteindex.tpl');
$foowd->template->display();
/*
 * destroy Foowd - triggers cleanup of database object and 
 /**
  * enter - class method
  * change to selected translation
  * @static
  * @param smdoc $foowd Reference to the foowd environment object. 
  */
 function class_enter(&$foowd)
 {
     $translation_id = new input_querystring('langid');
     $foowd->track('foowd_workspace->class_enter', $translation_id->value);
     $uri_arr = array();
     if ($translation_id->wasSet && $translation_id->wasValid && smdoc_translation::enterWorkspace($foowd, $translation_id->value)) {
         if ($translation_id->value == 0) {
             $_SESSION['ok'] = USER_DEFAULT_TRANSLATION;
         } else {
             $_SESSION['ok'] = USER_NEW_TRANSLATION;
         }
         $uri_arr['objectid'] = $translation_id->value;
         $uri_arr['classid'] = TRANSLATION_CLASS_ID;
     } else {
         $_SESSION['error'] = WORKSPACE_CHANGE_FAILED;
     }
     $foowd->track();
     //    $foowd->loc_forward( getURI($uri_arr, FALSE) );
     //    exit;
 }