Model\Node::getNodeArray PHP Method

getNodeArray() public static method

Get Node array
public static getNodeArray ( $type ) : Node[]
$type
return Node[]
    public static function getNodeArray($type = -1)
    {
        $nodeList = null;
        $selectSQL = "SELECT * FROM node ";
        if ($type != -1) {
            $selectSQL .= " WHERE type=?";
        }
        $selectSQL .= "  ORDER BY `order`";
        $statement = DB::getInstance()->prepare($selectSQL);
        $statement->bindValue(1, $type);
        $statement->execute();
        return $statement->fetchAll(DB::FETCH_CLASS, __CLASS__);
    }

Usage Example

Example #1
0
 public function index()
 {
     $data['user'] = User::getCurrent();
     $data['nodes'] = NodeModel::getNodeArray();
     Template::setContext($data);
     Template::setView('admin/node');
 }
All Usage Examples Of Model\Node::getNodeArray