Ejemplo n.º 1
0
if (!$draw->_id) {
    // author = self
    $draw->author_id = $user->_id;
    $draw->_ref_author = $user;
    $draw->file_type = "image/svg+xml";
    $draw->file_name = "Sans titre";
    // context
    if ($object && $object->_id) {
        $draw->setObject($object);
    } else {
        $draw->setObject($user);
    }
    $draw->loadTargetObject();
}
$file_categories = CFilesCategory::listCatClass($draw->_class);
$category = new CDrawingCategory();
$where = array("user_id" => " = '{$user->_id}'");
$categories_user = $category->loadList($where);
$where = array("function_id" => " = '{$user->function_id}'");
$categories_function = $category->loadList($where);
$where = array("group_id" => " = '{$user->_ref_function}->group_id'");
$categories_group = $category->loadList($where);
/** @var CDrawingCategory[] $categories */
$categories = $categories_user + $categories_function + $categories_group;
foreach ($functions as $_function) {
    $where = array("function_id" => " = '{$_function->_id}'");
    $categories_function = $category->loadList($where);
    $categories = array_merge($categories, $categories_function);
}
foreach ($categories as $_category) {
    $_category->countFiles();
Ejemplo n.º 2
0
<?php

/**
 * $Id$
 *  
 * @category Drawing
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$cat = new CDrawingCategory();
$cats = $cat->loadList(null, "name");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("cats", $cats);
$smarty->display("configure.tpl");
Ejemplo n.º 3
0
}
if ($file["type"] != "application/zip") {
    CAppUI::stepAjax("pas un zip", UI_MSG_ERROR);
}
$mb_file_name = $file["tmp_name"];
$zip = zip_open($mb_file_name);
while ($zipFile = zip_read($zip)) {
    $doc_name = zip_entry_name($zipFile);
    $extension = strtolower(pathinfo($doc_name, PATHINFO_EXTENSION));
    $file_name = pathinfo($doc_name, PATHINFO_BASENAME);
    $doc_size = zip_entry_filesize($zipFile);
    $dir_name = end(explode("/", dirname($doc_name)));
    if ((!$dir_name || $dir_name == ".") && $category || $category != "divers") {
        $dir_name = $category;
    }
    $cat = new CDrawingCategory();
    $cat->name = $dir_name;
    $cat->loadMatchingObjectEsc();
    if ($msg = $cat->store()) {
        CAppUI::stepAjax($msg, UI_MSG_WARNING);
    }
    $content_file = zip_entry_read($zipFile, $doc_size);
    if ($content_file) {
        $file = new CFile();
        $file->file_name = $file_name;
        $file->author_id = CAppUI::$user->_id;
        $file->file_type = CMbPath::guessMimeType($doc_name);
        $file->fillFields();
        $file->setObject($cat);
        $file->updateFormFields();
        $file->putContent($content_file);
<?php

/**
 * $Id$
 *  
 * @category Drawing
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$cat_id = CValue::get("category_id");
$category = new CDrawingCategory();
$category->load($cat_id);
$category->loadRefsFiles();
$smarty = new CSmartyDP();
$smarty->assign("category", $category);
$smarty->display("inc_list_files_for_category.tpl");
<?php

/**
 * $Id$
 *  
 * @category Drawing
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$id = CValue::get("id");
$mode_id = CValue::get("mode_id");
$mode = CValue::get("mode");
$cat = new CDrawingCategory();
$cat->load($id);
if (!$cat->_id) {
    $cat->{$mode} = $mode_id;
}
$nb_files = $cat->loadRefsFiles();
//smarty
$smarty = new CSmartyDP();
$smarty->assign("cat", $cat);
$smarty->display("inc_edit_category.tpl");