示例#1
0
文件: new.php 项目: rair/yacs
 * @author Bernard Paques
 * @author GnapZ
 * @author Christophe Battarel [email]christophe.battarel@altairis.fr[/email]
 * @reference
 * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
 */
// common definitions and initial processing
include_once '../shared/global.php';
include_once '../comments/comments.php';
// initiate the wall
// the maximum number of personal sections per user
if (!isset($context['users_maximum_managed_sections'])) {
    $context['users_maximum_managed_sections'] = 0;
}
// count sections owned by this surfer
$existing_sections = Sections::count_for_owner();
// load the skin before assessing permissions
load_skin('sections');
// surfer has to be an authenticated member --not accessible to subscribers
if (!Surfer::is_member()) {
    $permitted = FALSE;
} elseif (Surfer::is_associate()) {
    $permitted = TRUE;
} elseif ($existing_sections >= $context['users_maximum_managed_sections']) {
    $permitted = FALSE;
} else {
    $permitted = TRUE;
}
// do not always show the edition form
$with_form = FALSE;
// the path to this page
示例#2
0
文件: view.php 项目: rair/yacs
 //
 // my sections
 //
 $sections = '';
 // managed sections
 //
 // the list of assigned sections
 if (!$zoom_type || $zoom_type == 'sections') {
     // build a complete box
     $box = array('top' => array(), 'bottom' => array(), 'text' => '');
     // the maximum number of personal sections per user
     if (!isset($context['users_maximum_managed_sections'])) {
         $context['users_maximum_managed_sections'] = 0;
     }
     // offer to extend personal spaces
     if (Surfer::is($item['id']) && Surfer::is_member() && (Surfer::is_associate() || $context['users_maximum_managed_sections'] > Sections::count_for_owner())) {
         Skin::define_img('SECTIONS_ADD_IMG', 'sections/add.gif');
         $box['top'] += array('sections/new.php' => SECTIONS_ADD_IMG . i18n::s('Create a new web space'));
     }
     // associates can assign editors and readers
     if (Surfer::is_associate()) {
         Skin::define_img('SECTIONS_SELECT_IMG', 'sections/select.gif');
         $box['top'] += array('sections/select.php?anchor=user:'******'id'] => SECTIONS_SELECT_IMG . i18n::s('Assign sections'));
     }
     // count the number of articles for this user
     $count = Sections::count_for_user($item['id']);
     if ($count) {
         $box['bottom'] += array('_count' => sprintf(i18n::ns('%d section', '%d sections', $count), $count));
     }
     // navigation commands for articles
     $home = Users::get_permalink($item);