Example #1
0
/**
 * $Id$
 *
 * @category Files
 * @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::checkEdit();
$do = CValue::get("do", "0");
// Auto send categories
$category = new CFilesCategory();
$category->send_auto = "1";
foreach ($categories = $category->loadMatchingList() as $_category) {
    $_category->countDocItems();
    $_category->countUnsentDocItems();
}
// Unsent docItems
$max_load = CAppUI::conf("dPfiles CDocumentSender auto_max_load");
$where["file_category_id"] = CSQLDataSource::prepareIn(array_keys($categories));
$where["etat_envoi"] = "!= 'oui'";
$where["object_id"] = "IS NOT NULL";
$file = new CFile();
$items["CFile"] = $file->loadList($where, "file_id DESC", $max_load);
$count["CFile"] = $file->countList($where);
$document = new CCompteRendu();
$items["CCompteRendu"] = $document->loadList($where, "compte_rendu_id DESC", $max_load);
$count["CCompteRendu"] = $document->countList($where);
// Sending
 * $Id$
 *  
 * @category dPfiles
 * @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();
$user = CUser::get();
$object_guid = CValue::get("object_guid");
$object = CMbObject::loadFromGuid($object_guid);
$category = new CFilesCategory();
$category->eligible_file_view = 1;
$categories = $category->loadMatchingList();
$nb_unread = 0;
foreach ($categories as $_cat) {
    $file = new CFile();
    $file->file_category_id = $_cat->_id;
    $file->setObject($object);
    /** @var CFile[] $files */
    $_cat->_ref_files = $file->loadMatchingList();
    foreach ($_cat->_ref_files as $file_id => $_file) {
        $_file->loadRefReadStatus($user->_id);
        if (!$_file->_ref_read_status->_id) {
            $nb_unread++;
        } else {
            unset($_cat->_ref_files[$file_id]);
            continue;
        }