コード例 #1
0
ファイル: Cache.php プロジェクト: railfuture/tiki-website
 /**
  * Add Tiki object change information to reports cache
  * and remove it from the $watches array so that it is not 
  * send to the user in a single email.
  *  
  * @param array $watches a list of users watching the changed object and some information about the object itself
  * @param array $data information about the changed object
  * @param array $users a list of users that are using periodic reports
  * @return null
  */
 public function add(&$watches, $data, $users)
 {
     $data["base_url"] = TikiLib::tikiURL();
     //Store $base_url in the database. Use it to construct links in the email.
     foreach ($watches as $key => $watch) {
         // if user in the watch has enabled periodic reports
         if (in_array($watch['user'], $users)) {
             // add data to report cache
             $this->table->insert(array('user' => $watch['user'], 'event' => $data['event'], 'data' => serialize($data), 'time' => $this->dt->format('Y-m-d H:i:s')));
             // remove data from $watches array so that the user doesn't receive a email
             // notification for the event
             unset($watches[$key]);
         }
     }
 }