Пример #1
0
 /**
  *
  */
 public static function reload_object_current_locations($po_opts = null)
 {
     require_once __CA_LIB_DIR__ . "/core/Db.php";
     require_once __CA_MODELS_DIR__ . "/ca_objects.php";
     $o_db = new Db();
     $t_object = new ca_objects();
     $qr_res = $o_db->query("SELECT * FROM ca_objects");
     print CLIProgressBar::start($qr_res->numRows(), _t('Starting...'));
     $vn_c = 0;
     while ($qr_res->nextRow()) {
         $vn_object_id = $qr_res->get('object_id');
         if ($t_object->load($vn_object_id)) {
             print CLIProgressBar::next(1, _t('Processing %1', $t_object->getWithTemplate("^ca_objects.preferred_labels.name (^ca_objects.idno)")));
             $t_object->deriveCurrentLocationForBrowse();
         } else {
             print CLIProgressBar::next(1, _t('Cannot load object %1', $vn_object_id));
         }
         $vn_c++;
     }
     print CLIProgressBar::finish();
     CLIUtils::addMessage(_t('Processed %1 objects', $vn_c));
     return true;
 }