/**
  * @param array|object $item       The item
  * @param string       $columnName The column name
  *
  * @return string
  */
 public function getValue($item, $columnName)
 {
     if ($columnName == 'domain' && !$item->getDomain()) {
         return 'All domains';
     }
     return parent::getValue($item, $columnName);
 }
 /**
  * @param object $document
  * @param string $oldMessage
  * @param string $locale
  *
  * @return mixed
  */
 private function setDocument($document, $oldMessage, $locale)
 {
     $newDocument = new History();
     $key = $document->getKey();
     $domain = $document->getDomain();
     $newDocument->setKey($key);
     $newDocument->setLocale($locale);
     $newDocument->setMessage($oldMessage);
     $newDocument->setDomain($domain);
     $newDocument->setId(sha1($document->getId() . $oldMessage));
     $newDocument->setCreatedAt(new \DateTime());
     return $newDocument;
 }
Esempio n. 3
0
 /**
  * Setup of class.
  *
  * Generally helpers are instaciated with new Zikula_AbstractHelper($this), but it
  * will accept most Zikula classes, and override this method.
  *
  * @param object $object AbstractBase, ServiceManager, EventManager, AbstractEventHandler, AbstractHandler, or other.
  *
  * @return void
  */
 private function _setup($object)
 {
     $this->object = $object;
     if ($object instanceof AbstractBase || $object instanceof AbstractEventHandler || $object instanceof \Zikula\Core\Hook\AbstractHandler || $object instanceof AbstractPlugin) {
         $this->container = $object->getContainer();
         $this->dispatcher = $object->getDispatcher();
     } elseif ($object instanceof ContainerBuilder) {
         $this->container = $object;
         $this->dispatcher = $object->get('event_dispatcher');
     } elseif ($object instanceof EvenDispatcher) {
         $this->dispatcher = $object;
         $this->container = $object->getContainer();
     }
     if ($object instanceof AbstractBase) {
         $this->domain = $object->getDomain();
     }
 }
Esempio n. 4
0
    /**
     * Setup of class.
     *
     * Generally helpers are instaciated with new Zikula_AbstractHelper($this), but it
     * will accept most Zikula classes, and override this method.
     *
     * @param object $object Zikula_AbstractBase, Zikula_ServiceManager, Zikula_EventManager, Zikula_AbstractEventHandler, Zikula_Hook_AbstractHandler, or other.
     *
     * @return void
     */
    private function _setup($object)
    {
        $this->object = $object;

        if ($object instanceof Zikula_AbstractBase || $object instanceof Zikula_AbstractEventHandler || $object instanceof Zikula_Hook_AbstractHandler || $object instanceof Zikula_AbstractPlugin) {
            $this->serviceManager = $object->getServiceManager();
            $this->eventManager = $object->getEventManager();
        } else if ($object instanceof Zikula_ServiceManager) {
            $this->serviceManager = $object;
            $this->eventManager = $object->getService('zikula.eventmanager');
        } else if ($object instanceof Zikula_EventManager) {
            $this->eventManager = $object;
            $this->serviceManager = $object->getServiceManager();
        }

        if ($object instanceof Zikula_AbstractBase) {
            $this->domain = $object->getDomain();
        }
    }
Esempio n. 5
0
 /**
  * Setup of class.
  *
  * Generally helpers are instaciated with new Zikula_AbstractHelper($this), but it
  * will accept most Zikula classes, and override this method.
  *
  * @param object $object Zikula_AbstractBase, Zikula_ServiceManager, Zikula_EventManager, Zikula_AbstractEventHandler, Zikula_Hook_AbstractHandler, or other.
  *
  * @return void
  */
 private function _setup($object)
 {
     $this->object = $object;
     if ($object instanceof Zikula_AbstractBase || $object instanceof Zikula_AbstractEventHandler || $object instanceof Zikula_Hook_AbstractHandler || $object instanceof Zikula_AbstractPlugin) {
         $this->serviceManager = $object->getContainer();
         $this->eventManager = $object->getDispatcher();
     } elseif ($object instanceof Zikula_ServiceManager) {
         $this->serviceManager = $object;
         $this->eventManager = $object->get('event_dispatcher');
     } elseif ($object instanceof EventDispatcherInterface) {
         $this->eventManager = $object;
         $this->serviceManager = $object->getContainer();
     }
     if ($object instanceof Zikula_AbstractBase) {
         $this->domain = $object->getDomain();
     }
 }
 /**
  * Answer the Harmoni_Db statement for an Implicit AZ query
  * 
  * @param array $agentIds The string id of an agent.
  * @param string $fId The string id of a function.
  * @param string $qId The string id of a qualifier. This parameter can not be null
  * and used as a wildmark.
  * @param object $fType The type of a function.
  * @return Harmoni_Db_Statement
  * @access protected
  * @since 7/11/08
  */
 protected function getImplicitAZQueryStatement(array $agentIds, $fId, $qId, $fType, $isActiveNow)
 {
     // 			$fType = new Type('Authorization', 'edu.middlebury.harmoni', 'View/Use'); // debug
     if (!isset($this->getImplicitAZQueryResult_stmts)) {
         $this->getImplicitAZQueryResult_stmts = array();
     }
     $queryKey = 'Query';
     if (count($agentIds)) {
         $queryKey .= ', with Agents: ' . implode(' ', $agentIds);
     }
     if ($qId) {
         $queryKey .= ', with qId';
     }
     if ($fId) {
         $queryKey .= ', with fId';
     }
     if ($fType) {
         $queryKey .= ', with fType';
     }
     if ($isActiveNow) {
         $queryKey .= ', active';
     }
     // Create the statement
     if (!isset($this->getImplicitAZQueryResult_stmts[$queryKey])) {
         $query = $this->harmoni_db->select();
         $query->addColumn("fk_explicit_az");
         $query->addColumn("id", "id", "az2_implicit_az");
         $query->addColumn("fk_agent", "aid");
         $query->addColumn("fk_function", "fid");
         $query->addColumn("fk_qualifier", "qid");
         $query->addColumn("effective_date", "eff_date");
         $query->addColumn("expiration_date", "exp_date");
         $query->addTable("az2_implicit_az");
         if (count($agentIds)) {
             $query->addWhereIn('fk_agent', $agentIds);
         }
         if ($qId) {
             $query->addWhere($this->harmoni_db->quoteIdentifier('fk_qualifier') . ' = :qId');
         }
         if ($fId) {
             $query->addWhere($this->harmoni_db->quoteIdentifier('fk_function') . ' = :fId');
         }
         if ($fType) {
             $subQuery = $this->harmoni_db->select();
             $subQuery->addColumn("az2_function.id");
             $subQuery->addTable("az2_function_type");
             $subQuery->addTable("az2_function", INNER_JOIN, 'az2_function_type.id = az2_function.fk_type');
             $subQuery->addWhere($this->harmoni_db->quoteIdentifier('domain') . ' = :domain');
             $subQuery->addWhere($this->harmoni_db->quoteIdentifier('authority') . ' = :authority');
             $subQuery->addWhere($this->harmoni_db->quoteIdentifier('keyword') . ' = :keyword');
             $query->addWhere($this->harmoni_db->quoteIdentifier('fk_function') . ' IN (' . $subQuery . ')');
             // 					$query->addWhere('fk_function.id', $subQuery);
         }
         // the isActiveNow criteria
         if ($isActiveNow) {
             $where = "(effective_date IS NULL OR (NOW() >= effective_date))";
             $query->addWhere($where);
             $where = "(expiration_date IS NULL OR (NOW() < expiration_date))";
             $query->addWhere($where);
         }
         $query->addOrderBy("az2_implicit_az.id");
         // 			printpre($query->asString());
         // 				throw new Exception('debug');
         $this->getImplicitAZQueryResult_stmts[$queryKey] = $query->prepare();
     }
     // Bind the params
     if ($qId) {
         $this->getImplicitAZQueryResult_stmts[$queryKey]->bindValue(':qId', $qId);
     }
     if ($fId) {
         $this->getImplicitAZQueryResult_stmts[$queryKey]->bindValue(':fId', $fId);
     }
     if ($fType) {
         $this->getImplicitAZQueryResult_stmts[$queryKey]->bindValue(':domain', $fType->getDomain());
         $this->getImplicitAZQueryResult_stmts[$queryKey]->bindValue(':authority', $fType->getDomain());
         $this->getImplicitAZQueryResult_stmts[$queryKey]->bindValue(':keyword', $fType->getDomain());
     }
     return $this->getImplicitAZQueryResult_stmts[$queryKey];
 }