Beispiel #1
0
 public function getTypeObject()
 {
     $class = substr(get_called_class(), strrpos(get_called_class(), '\\') + 1);
     $class = substr($class, 0, strpos($class, 'Configuration'));
     $handle = uncamelcase($class);
     return \Concrete\Core\File\StorageLocation\Type\Type::getByHandle($handle);
 }
Beispiel #2
0
 /**
  * Returns a path to an elements directory for this Style. Might not be used by all styles.
  *
  * @return string
  */
 public function getFormElementPath()
 {
     $className = implode('', array_slice(explode('\\', get_called_class()), -1));
     $segment = substr($className, 0, strpos($className, 'Style'));
     $element = uncamelcase($segment);
     $env = Environment::get();
     return $env->getPath(DIRNAME_ELEMENTS . '/' . DIRNAME_STYLE_CUSTOMIZER . '/' . DIRNAME_STYLE_CUSTOMIZER_TYPES . '/' . $element . '.php');
 }
 public function __construct()
 {
     parent::__construct();
     if ($this->viewPath) {
         $this->view = new View($this->viewPath);
         if (preg_match('/Concrete\\\\Package\\\\(.*)\\\\Controller/i', get_class($this), $matches)) {
             $pkgHandle = uncamelcase($matches[1]);
             $this->view->setPackageHandle($pkgHandle);
         }
         $this->view->setController($this);
     }
 }
 public function __construct()
 {
     $this->error = \Core::make('helper/validation/error');
     $this->view = new DialogView($this->viewPath);
     if (preg_match('/Concrete\\\\Package\\\\(.*)\\\\Controller/i', get_class($this), $matches)) {
         $pkgHandle = uncamelcase($matches[1]);
         $this->view->setPackageHandle($pkgHandle);
     }
     $this->view->setController($this);
     $request = Request::getInstance();
     $this->request = $request;
 }
 /**
  * @param $association \Concrete\Core\Entity\Express\Association
  * @param \SimpleXMLElement $xml
  */
 public function export($association, \SimpleXMLElement $xml)
 {
     $node = $xml->addChild('association');
     // turns fully qualified class name into one_to_many
     $class = substr(get_class($association), strrpos(get_class($association), '\\') + 1);
     $type = uncamelcase(substr($class, 0, strpos($class, 'Association')));
     $node->addAttribute('type', $type);
     $node->addAttribute('source-entity', $association->getSourceEntity()->getID());
     $node->addAttribute('target-entity', $association->getTargetEntity()->getID());
     $node->addAttribute('target-property-name', $association->getTargetPropertyName());
     $node->addAttribute('inversed-by-property-name', $association->getInversedByPropertyName());
     return $node;
 }
 /**
  * Magic method for setting up additional filtering by attributes.
  * @param $nm
  * @param $a
  * @throws \Exception
  */
 public function __call($nm, $a)
 {
     if (substr($nm, 0, 8) == 'filterBy') {
         $handle = uncamelcase(substr($nm, 8));
         if (count($a) == 2) {
             $this->filterByAttribute($handle, $a[0], $a[1]);
         } else {
             $this->filterByAttribute($handle, $a[0]);
         }
     } else {
         if (substr($nm, 0, 6) == 'sortBy') {
             $handle = uncamelcase(substr($nm, 6));
             if (count($a) == 1) {
                 $this->sanitizedSortBy('ak_' . $handle, $a[0]);
             } else {
                 $this->sanitizedSortBy('ak_' . $handle);
             }
         } else {
             throw new \Exception(t('%s method does not exist for the %s class', $nm, get_called_class()));
         }
     }
 }
Beispiel #7
0
 protected static function create(TreeNode $rootNode)
 {
     $app = Application::getFacadeApplication();
     $db = $app->make('database')->connection();
     $date = $app->make('date')->getOverridableNow();
     $treeTypeHandle = uncamelcase(strrchr(get_called_class(), '\\'));
     $type = TreeType::getByHandle($treeTypeHandle);
     $db->executeQuery('insert into Trees (treeDateAdded, rootTreeNodeID, treeTypeID) values (?, ?, ?)', [$date, $rootNode->getTreeNodeID(), $type->getTreeTypeID()]);
     $treeID = $db->lastInsertId();
     $rootNode->setTreeNodeTreeID($treeID);
     return $treeID;
 }
 public function getComputedInversedByPropertyName()
 {
     if ($this->getInversedByPropertyName()) {
         return $this->getInversedByPropertyName();
     } else {
         return uncamelcase($this->getSourceEntity()->getName());
     }
 }
Beispiel #9
0
 public static function uncamelcase($string)
 {
     return uncamelcase($string);
 }
Beispiel #10
0
 public static function getNodeByName($name)
 {
     $db = Database::connection();
     $treeNodeTypeHandle = uncamelcase(strrchr(get_called_class(), '\\'));
     $type = TreeNodeType::getByHandle($treeNodeTypeHandle);
     $treeNodeID = $db->fetchColumn('select treeNodeID from TreeNodes where treeNodeName = ? and treeNodeTypeID = ?', [$name, $type->getTreeNodeTypeID()]);
     if ($treeNodeID) {
         return static::getByID($treeNodeID);
     }
 }