/** * Count unsent document items * * @return void */ function countUnsentDocItems() { $where["file_category_id"] = "= '{$this->_id}'"; $where["etat_envoi"] = "!= 'oui'"; $where["object_id"] = "IS NOT NULL"; $file = new CFile(); $this->_count_unsent_files = $file->countList($where); $document = new CCompteRendu(); $this->_count_unsent_documents = $document->countList($where); $this->_count_unsent_doc_items = $this->_count_unsent_documents + $this->_count_unsent_files; }
$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 $max_send = CAppUI::conf("dPfiles CDocumentSender auto_max_send"); foreach ($items as $_items) { $sent = 0; /** @var CDocumentItem[] $_items */ foreach ($_items as $_item) { $_item->loadTargetObject(); if ($do && !$_item->_send_problem) { // Max sent if (++$sent > $max_send) { break; }
<?php /** * $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::checkAdmin(); $file = new CFile(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("listNbFiles", range(1, 10)); $smarty->assign("today", CMbDT::date()); $smarty->assign("nb_files", $file->countList() / 100); $smarty->display("configure.tpl");
$extensions = CValue::get("extensions", CFile::$file_types); $file = new CFile(); $where = array(); $where["object_class"] = " NOT LIKE 'CFile'"; // Ne convertir que les fichiers dont le nom se finit par une extension convertible $like = ""; $types = preg_split("/[\\s]+/", $extensions); foreach ($types as $key => $_type) { $like .= " file_name LIKE '%.{$_type}'"; if ($key != count($types) - 1) { $like .= " OR"; } } $where[] = $like; $where[] = "file_id NOT IN (SELECT object_id from files_mediboard WHERE object_class LIKE 'CFile')"; $order = "file_id DESC"; $files = $file->loadList($where, $order, $nb_files); $nb_files_total = $file->countList($where); $converted = 0; $not_converted = ""; foreach ($files as $_file) { if ($_file->convertToPDF()) { $converted++; } else { $not_converted .= $_file->_id . " - "; } } CAppUI::stepAjax("{$converted}/" . count($files) . " fichiers convertis parmi {$nb_files_total}"); if ($converted != count($files)) { trigger_error("Les fichiers suivants n'ont pas été convertis : {$not_converted}", E_USER_ERROR); }