Example #1
0
 public function _category()
 {
     $oView = new _view('default::index');
     $this->oLayout->add('main', $oView);
     //posts (main)
     $oModuleExamplemodule = new module_posts();
     $oModuleExamplemodule->setCategory(_root::getParam('id'));
     //si vous souhaitez indiquer au module integrable des informations sur le module parent
     $oModuleExamplemodule->setRootLink('default::categoryDetail', array('id' => _root::getParam('id')));
     //recupere la vue du module
     $oViewModule = $oModuleExamplemodule->_index();
     //assigner la vue retournee a votre layout
     $this->oLayout->add('main', $oViewModule);
 }
Example #2
0
 public function processSave()
 {
     if (!_root::getRequest()->isPost() or _root::getParam('formmodule') != self::$sModuleName) {
         //si ce n'est pas une requete POST on ne soumet pas
         return null;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $iId = module_posts::getParam('id', null);
     if ($iId == null) {
         $oPosts = new row_posts();
     } else {
         $oPosts = model_posts::getInstance()->findById(module_posts::getParam('id', null));
     }
     $tId = model_posts::getInstance()->getIdTab();
     $tColumn = model_posts::getInstance()->getListColumn();
     foreach ($tColumn as $sColumn) {
         $oPluginUpload = new plugin_upload($sColumn);
         if ($oPluginUpload->isValid()) {
             $sNewFileName = _root::getConfigVar('path.upload') . $sColumn . '_' . date('Ymdhis');
             $oPluginUpload->saveAs($sNewFileName);
             $oPosts->{$sColumn} = $oPluginUpload->getPath();
             continue;
         } else {
             if (_root::getParam($sColumn, null) === null) {
                 continue;
             } else {
                 if (in_array($sColumn, $tId)) {
                     continue;
                 }
             }
         }
         $oPosts->{$sColumn} = _root::getParam($sColumn, null);
     }
     if ($oPosts->save()) {
         //une fois enregistre on redirige (vers la page liste)
         $this->redirect('list');
     } else {
         return $oPosts->getListError();
     }
 }
Example #3
0
        echo _root::getLink('default::index');
        ?>
"><?php 
        echo $this->tJoinmodel_users[$oPosts->user_id];
        ?>
</a> on <em><?php 
        $oDate = new plugin_datetime($oPosts->created);
        echo $oDate->toString('D dS Y');
        ?>
</em>
			</small></p>
			<p><?php 
        echo substr(trim(plugin_markdown::tr($oPosts->content)), 0, 190);
        ?>
...</p>
			<p class="text-right"><a href="<?php 
        echo module_posts::getLink('show', array('slug' => $oPosts->slug));
        ?>
" class="btn btn-primary">Read more...</a></p>
		</article>
	<?php 
    }
}
?>


<?php 
echo $this->oPagination->build()->show();
?>