public function GetMethods($max = null)
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectMethods WHERE method_ObjectID = " . $this->ID;
     if (is_numeric($max)) {
         $query .= " LIMIT " . $max;
     }
     $result = $MySQL->query($query);
     $retval = array();
     if ($result === false) {
         return $retval;
     }
     $count = $result->num_rows;
     for ($i = 0; $i < $count; $i++) {
         $values = $result->fetch_assoc();
         $retval[] = TenantObjectMethod::GetByAssoc($values);
     }
     return $retval;
 }
 /**
  * Retrieves a single TenantObjectMethod with the given ID.
  * @param int $id The ID of the TenantObjectMethod to return
  * @return NULL|\PhoenixSNS\Objects\TenantObjectMethod The TenantObjectMethod with the given ID
  */
 public static function GetByID($id)
 {
     if (!is_numeric($id)) {
         return null;
     }
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantObjectMethods WHERE method_ID = " . $id;
     $result = $MySQL->query($query);
     if ($result === false) {
         return null;
     }
     $count = $result->num_rows;
     if ($count == 0) {
         return null;
     }
     $values = $result->fetch_assoc();
     return TenantObjectMethod::GetByAssoc($values);
 }
Exemple #3
0
     switch ($path[4]) {
         case "":
             $tenant = Tenant::GetByURL($path[0]);
             $object = TenantObject::GetByID($path[2]);
             $page = new TenantObjectInstanceBrowsePage();
             $page->CurrentTenant = $tenant;
             $page->CurrentObject = $object;
             $page->Render();
             break;
     }
 case "methods":
     switch ($path[4]) {
         case "static":
             $tenant = Tenant::GetByURL($path[0]);
             $object = TenantObject::GetByID($path[2]);
             $method = TenantObjectMethod::GetByID($path[5]);
             if ($_SERVER["REQUEST_METHOD"] == "POST") {
                 $method->CodeBlob = $_POST["method_CodeBlob"];
                 $method->Update();
                 System::Redirect("~/tenant/manage/" . $tenant->URL . "/objects/" . $object->ID);
                 return true;
             }
             $page = new TenantObjectMethodManagementPage();
             $page->CurrentTenant = $tenant;
             $page->CurrentObject = $object;
             $page->CurrentMethod = $method;
             $page->Render();
             break;
         case "instance":
             $page = new TenantObjectMethodManagementPage();
             $page->CurrentTenant = Tenant::GetByURL($path[0]);