예제 #1
0
 public static function pendingContent(Zikula_Event $event)
 {
     $dom = ZLanguage::getModuleDomain('News');
     ModUtil::dbInfoLoad('News');
     $dbtables = DBUtil::getTables();
     $columns = $dbtables['news_column'];
     $count = DBUtil::selectObjectCount('news', "WHERE $columns[published_status]=2");
     if ($count > 0) {
         $collection = new Zikula_Collection_Container('News');
         $collection->add(new Zikula_Provider_AggregateItem('submission', _n('News article', 'News articles', $count, $dom), $count, 'admin', 'view', array('news_status'=>2)));
         $event->getSubject()->add($collection);
     }
 }
 /**
  * Respond to 'get.pending_content' events with registration requests pending approval.
  *
  * When a 'get.pending_content' event is fired, the Users module will respond with the
  * number of registration requests that are pending administrator approval. The number
  * pending may not equal the total number of outstanding registration requests, depending
  * on how the 'moderation_order' module configuration variable is set, and whether e-mail
  * address verification is required.
  *
  * If the 'moderation_order' variable is set to require approval after e-mail verification
  * (and e-mail verification is also required) then the number of pending registration
  * requests will equal the number of registration requested that have completed the
  * verification process but have not yet been approved. For other values of
  * 'moderation_order', the number should equal the number of registration requests that
  * have not yet been approved, without regard to their current e-mail verification state.
  * If moderation of registrations is not enabled, then the value will always be 0.
  *
  * In accordance with the 'get_pending_content' conventions, the count of pending
  * registrations, along with information necessary to access the detailed list, is
  * assemped as a {@link Zikula_Provider_AggregateItem} and added to the event
  * subject's collection.
  *
  * @param GenericEvent $event The event that was fired, a 'get_pending_content' event.
  *
  * @return void
  */
 public static function pendingContentListener(GenericEvent $event)
 {
     if (SecurityUtil::checkPermission('Users::', '::', ACCESS_MODERATE)) {
         $approvalOrder = ModUtil::getVar(self::$modname, 'moderation_order', UsersConstant::APPROVAL_ANY);
         if ($approvalOrder == UsersConstant::APPROVAL_AFTER) {
             $numPendingApproval = ModUtil::apiFunc(self::$modname, 'registration', 'countAll', array('filter' => array('approved_by' => 0, 'isverified' => true)));
         } else {
             $numPendingApproval = ModUtil::apiFunc(self::$modname, 'registration', 'countAll', array('filter' => array('approved_by' => 0)));
         }
         if (!empty($numPendingApproval)) {
             $collection = new \Zikula_Collection_Container(self::$modname);
             $collection->add(new \Zikula_Provider_AggregateItem('registrations', __('Registrations pending approval'), $numPendingApproval, 'admin', 'viewRegistrations'));
             $event->getSubject()->add($collection);
         }
     }
 }
예제 #3
0
 /**
  * Listener for the 'get.pending_content' event with registration requests and
  * other submitted data pending approval.
  *
  * When a 'get.pending_content' event is fired, the Users module will respond with the
  * number of registration requests that are pending administrator approval. The number
  * pending may not equal the total number of outstanding registration requests, depending
  * on how the 'moderation_order' module configuration variable is set, and whether e-mail
  * address verification is required.
  * If the 'moderation_order' variable is set to require approval after e-mail verification
  * (and e-mail verification is also required) then the number of pending registration
  * requests will equal the number of registration requested that have completed the
  * verification process but have not yet been approved. For other values of
  * 'moderation_order', the number should equal the number of registration requests that
  * have not yet been approved, without regard to their current e-mail verification state.
  * If moderation of registrations is not enabled, then the value will always be 0.
  * In accordance with the 'get_pending_content' conventions, the count of pending
  * registrations, along with information necessary to access the detailed list, is
  * assemped as a {@link Zikula_Provider_AggregateItem} and added to the event
  * subject's collection.
  *
  * @param Zikula_Event $event The event instance.
  */
 public static function pendingContentListener(Zikula_Event $event)
 {
     $serviceManager = ServiceUtil::getManager();
     $workflowHelper = new Reviews_Util_Workflow($serviceManager);
     $modname = 'Reviews';
     $useJoins = false;
     $collection = new Zikula_Collection_Container($modname);
     $amounts = $workflowHelper->collectAmountOfModerationItems();
     if (count($amounts) > 0) {
         foreach ($amounts as $amountInfo) {
             $aggregateType = $amountInfo['aggregateType'];
             $description = $amountInfo['description'];
             $amount = $amountInfo['amount'];
             $viewArgs = array('ot' => $amountInfo['objectType'], 'workflowState' => $amountInfo['state']);
             $aggregateItem = new Zikula_Provider_AggregateItem($aggregateType, $description, $amount, 'admin', 'view', $viewArgs);
             $collection->add($aggregateItem);
         }
         // add collected items for pending content
         if ($collection->count() > 0) {
             $event->getSubject()->add($collection);
         }
     }
 }