Exemplo n.º 1
0
 /**
  * Event call to get side content for main project page
  *
  * @return
  */
 public function onProjectMiniList($model)
 {
     if (!$model->exists() || !$model->access('content')) {
         return false;
     }
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'notes', 'name' => 'mini'));
     $group = $model->config()->get('group_prefix', 'pr-') . $model->get('alias');
     $masterScope = 'projects' . DS . $model->get('alias') . DS . 'notes';
     // Get our model
     $note = new \Components\Projects\Models\Note($masterScope, $group, $model->get('id'));
     $view->notes = $note->getNotes();
     $view->model = $model;
     return $view->loadTemplate();
 }
Exemplo n.º 2
0
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */
// No direct access
defined('_HZEXEC_') or die;
$masterscope = 'projects' . DS . $this->model->get('alias') . DS . 'notes';
// Set project (system) group
$group_prefix = $this->config->get('group_prefix', 'pr-');
$group = $group_prefix . $this->model->get('alias');
// Get our model
$note = new \Components\Projects\Models\Note($masterscope, $group, $this->model->get('id'));
// Get notes to choose from
$items = $note->getNotes();
// Sort notes to display hierarchy by scope
$notes = array();
$order = array();
$thirdlevel = array();
if ($items) {
    foreach ($items as $note) {
        $parts = explode('/', $note->scope);
        $remaining = array_slice($parts, 3);
        $level = count($remaining) + 1;
        $parent = $level > 1 ? array_shift($remaining) : '';
        if ($level == 1) {
            $notes[$note->pagename] = array($level => array($note));
        } elseif ($level == 2) {
            $notes[$parent][$level][] = $note;
        } elseif ($level >= 3) {