示例#1
0
 /**
  * Write sosas in the table, if the number of items is superior to the limit, or if forced.
  *
  * @param bool $force Should the flush be forced
  */
 protected function flushTmpSosaTable($force = false)
 {
     if (count($this->tmp_sosa_table) > 0 && ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)) {
         $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table);
         $this->tmp_sosa_table = array();
     }
 }
 /**
  * SosaConfig@computePartial
  */
 public function computePartial()
 {
     global $WT_TREE;
     $controller = new AjaxController();
     $controller->restrictAccess($this->canUpdate());
     $view_bag = new ViewBag();
     $view_bag->set('is_success', false);
     $user = User::find(Filter::getInteger('userid', -1));
     $indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
     if ($user && $indi) {
         $calculator = new SosaCalculator($WT_TREE, $user);
         if ($calculator->computeFromIndividual($indi)) {
             $view_bag->set('is_success', true);
         }
     } else {
         $view_bag->set('error', I18N::translate('Non existing individual'));
     }
     ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
 }