Пример #1
0
 /**
  * Build id-title array of sorted by nesting level categories
  * @return array
  */
 public static function getSortedCategories()
 {
     $response = [];
     $tmpData = self::getSortedAll();
     foreach ($tmpData as $path => $data) {
         $title = null;
         if (Str::likeEmpty($path)) {
             $title .= '--';
         } else {
             // set level marker based on slashes count in pathway
             $slashCount = Str::entryCount($path, '/');
             for ($i = -1; $i <= $slashCount; $i++) {
                 $title .= '--';
             }
         }
         // add canonical title from db
         $title .= ' ' . $data->getLocaled('title');
         // set response as array [id => title, ... ]
         $response[$data->id] = $title;
     }
     return $response;
 }
Пример #2
0
</th>
            <th class="col-md-2 text-center"><?php 
echo __('Actions');
?>
</th>
        </tr>
        </thead>
        <tbody>
        <?php 
foreach ($categories as $path => $row) {
    $offset = 2;
    $nesting = 0;
    if ($row->path === '') {
        --$offset;
    } else {
        $nesting = Str::entryCount($row->path, '/');
        $offset += $nesting;
    }
    if ($offset > 8) {
        $offset = 8;
    }
    $set = 12 - $offset;
    ?>
            <tr>
                <td>
                    <div class="row">
                        <div class="col-md-<?php 
    echo $offset;
    ?>
 col-xs-<?php 
    echo $offset + 2;