コード例 #1
0
 /**
  * @see	\wcf\system\importer\IImporter::import()
  */
 public function import($oldID, array $data, array $additionalData = array())
 {
     $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
     if (!$data['userID']) {
         return 0;
     }
     $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID)));
     return $watch->watchID;
 }
コード例 #2
0
 /**
  * @see	\wcf\system\importer\IImporter::import()
  */
 public function import($oldID, array $data, array $additionalData = array())
 {
     $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
     if (!$data['userID']) {
         return 0;
     }
     try {
         $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID)));
         return $watch->watchID;
     } catch (DatabaseException $e) {
         // 23000 = INTEGRITY CONSTRAINT VIOLATION a.k.a. duplicate key
         if ($e->getCode() != 23000) {
             throw $e;
         }
     }
     return 0;
 }
コード例 #3
0
 /**
  * Removes a subscription.
  */
 public function unsubscribe()
 {
     $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $this->parameters['data']['objectType']);
     if ($this->userObjectWatch !== null) {
         $userObjectWatch = $this->userObjectWatch;
     } else {
         $userObjectWatch = UserObjectWatch::getUserObjectWatch($objectType->objectTypeID, WCF::getUser()->userID, intval($this->parameters['data']['objectID']));
     }
     $editor = new UserObjectWatchEditor($userObjectWatch);
     $editor->delete();
     // reset user storage
     $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID));
 }
コード例 #4
0
 /**
  * unsubscribe topic
  *
  * @param  $oMbqEtForumTopic
  */
 public function unsubscribeTopic($oMbqEtForumTopic)
 {
     //ref wcf\data\user\object\watch\UserObjectWatchAction::unsubscribe()
     $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread');
     $userObjectWatch = UserObjectWatch::getUserObjectWatch($objectType->objectTypeID, WCF::getUser()->userID, intval($oMbqEtForumTopic->topicId->oriValue));
     if ($userObjectWatch->watchID) {
         $editor = new UserObjectWatchEditor($userObjectWatch);
         $editor->delete();
         // reset user storage
         $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID));
     }
     return true;
 }
コード例 #5
0
ファイル: MbqWrEtForumTopic.php プロジェクト: ZerGabriel/wbb
 /**
  * unsubscribe topic
  *
  * @param  Mixed  $var($oMbqEtForumTopic or $objsMbqEtForumTopic)
  */
 public function unsubscribeTopic(&$var)
 {
     if (is_array($var)) {
         MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_NOT_ACHIEVE);
     } else {
         //ref wcf\data\user\object\watch\UserObjectWatchAction::unsubscribe()
         $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread');
         $userObjectWatch = UserObjectWatch::getUserObjectWatch($objectType->objectTypeID, WCF::getUser()->userID, intval($var->topicId->oriValue));
         if ($userObjectWatch->watchID) {
             $editor = new UserObjectWatchEditor($userObjectWatch);
             $editor->delete();
             // reset user storage
             $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID));
         }
     }
 }