Esempio n. 1
0
 public function getTasks()
 {
     return $this->get('moderators_tasks', function ($item, $model) {
         $item['url'] = rel_to_href($item['url']);
         return $item;
     });
 }
Esempio n. 2
0
                            <td class="field ft_<?php 
            echo $field['type'];
            ?>
 f_<?php 
            echo $field['name'];
            ?>
">
                                <?php 
            if ($field['name'] == 'title' && $ctype['options']['item_on']) {
                ?>
                                    <h2>
                                    <?php 
                if ($item['parent_id']) {
                    ?>
                                        <a class="parent_title" href="<?php 
                    echo rel_to_href($item['parent_url']);
                    ?>
"><?php 
                    echo htmlspecialchars($item['parent_title']);
                    ?>
</a>
                                        &rarr;
                                    <?php 
                }
                ?>
                                    <a href="<?php 
                echo href_to($ctype['name'], $item['slug'] . '.html');
                ?>
"><?php 
                echo htmlspecialchars($item[$field['name']]);
                ?>
Esempio n. 3
0
?>

<?php 
foreach ($comments as $entry) {
    $no_approved_class = $entry['is_approved'] ? '' : 'no_approved';
    if (!isset($is_levels)) {
        $is_levels = true;
    }
    if (!isset($is_controls)) {
        $is_controls = true;
    }
    if (!isset($is_show_target)) {
        $is_show_target = false;
    }
    if ($is_show_target) {
        $target_url = rel_to_href($entry['target_url']) . "#comment_{$entry['id']}";
    }
    if ($is_controls) {
        $is_can_edit = cmsUser::isAllowed('comments', 'edit', 'all') || cmsUser::isAllowed('comments', 'edit', 'own') && $entry['user']['id'] == $user->id;
        $is_can_delete = cmsUser::isAllowed('comments', 'delete', 'all') || cmsUser::isAllowed('comments', 'delete', 'own') && $entry['user']['id'] == $user->id;
    }
    $is_selected = $is_highlight_new && (int) strtotime($entry['date_pub']) > (int) strtotime($user->date_log);
    $level = ($limit_nesting && $entry['level'] > $limit_nesting ? $limit_nesting : $entry['level'] - 1) * 30;
    ?>

<div id="comment_<?php 
    echo $entry['id'];
    ?>
" class="comment<?php 
    if ($is_selected) {
        ?>
Esempio n. 4
0
 public function getEntries()
 {
     $this->select('u.nickname', 'user_nickname');
     $this->select('u.avatar', 'user_avatar');
     $this->join('{users}', 'u', 'u.id = i.user_id');
     $this->select('t.description', 'description');
     $this->join('activity_types', 't', 't.id = i.type_id');
     if (!$this->order_by) {
         $this->orderBy('date_pub', 'desc');
     }
     $this->useCache('activity.entries');
     $config = cmsConfig::getInstance();
     return $this->get('activity', function ($item, $model) use($config) {
         $item['user'] = array('id' => $item['user_id'], 'nickname' => $item['user_nickname'], 'avatar' => $item['user_avatar']);
         if (!empty($item['subject_url'])) {
             $item['subject_url'] = rel_to_href($item['subject_url']);
             $max_title_len = 50;
             $item['subject_title'] = mb_strlen($item['subject_title']) > $max_title_len ? mb_substr($item['subject_title'], 0, $max_title_len) . '...' : $item['subject_title'];
             $link = '<a href="' . $item['subject_url'] . '">' . $item['subject_title'] . '</a>';
         } else {
             $link = $item['subject_title'];
         }
         if (!empty($item['reply_url'])) {
             $item['reply_url'] = rel_to_href($item['reply_url']);
         }
         $item['images'] = cmsModel::yamlToArray($item['images']);
         if ($item['images']) {
             $images_exist = array();
             foreach ($item['images'] as $key => $image) {
                 if (strpos($image['src'], 'http') !== 0) {
                     if (!file_exists($config->upload_path . '/' . $image['src'])) {
                         continue;
                     }
                     $image['src'] = $config->upload_host . '/' . $image['src'];
                 }
                 $image['url'] = rel_to_href($image['url']);
                 $images_exist[] = $image;
             }
             if (!$images_exist) {
                 $model->deleteEntryById($item['id']);
             }
             $item['images'] = $images_exist;
         }
         $item['description'] = sprintf($item['description'], $link);
         $item['date_diff'] = string_date_age_max($item['date_pub'], true);
         return $item;
     });
 }
Esempio n. 5
0
    foreach ($datasets as $set) {
        ?>
                <?php 
        $ds_selected = $dataset == $set['name'] || !$dataset && $ds_counter == 0;
        ?>
                <li <?php 
        if ($ds_selected) {
            ?>
class="active"<?php 
        }
        ?>
>

                    <?php 
        if ($ds_counter > 0) {
            $ds_url = sprintf(rel_to_href($base_ds_url), $set['name']);
        }
        ?>
                    <?php 
        if ($ds_counter == 0) {
            $ds_url = href_to($base_url, isset($category['slug']) ? $category['slug'] : '');
        }
        ?>

                    <?php 
        if ($ds_selected) {
            ?>
                        <div><?php 
            echo $set['title'];
            ?>
</div>