Пример #1
0
 public function __construct(QcodoClass $objClass, $objParentControl, $strControlId = null)
 {
     parent::__construct($objParentControl, $strControlId);
     $this->objQcodoClass = $objClass;
     $this->strTemplate = 'ClassPanel.tpl.php';
     $this->strUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php/' . $this->objQcodoClass->Name;
     $this->strShortDescriptionHtml = $this->objQcodoClass->ShortDescriptionAsHtml;
     if (!$this->strShortDescriptionHtml) {
         $this->strShortDescriptionHtml = '<span style="color: #888888;"><i>No description entered yet.</i></span>';
     }
     $this->strLongDescriptionHtml = QWriteBox::DisplayHtml($this->objQcodoClass->ExtendedDescription, 'writebox_code');
     $this->strVersion = 'Qcodo >= ' . $this->objQcodoClass->FirstVersion;
     if ($this->objQcodoClass->LastVersion) {
         $this->strVersion .= ' - Deprecated as of ' . $this->objQcodoClass->LastVersion;
     }
     $this->strParentClassArray[$objClass->Id] = $objClass->DisplayName;
     $objParentClass = $objClass->ParentQcodoClass;
     while ($objParentClass) {
         $this->strParentClassArray[$objParentClass->Id] = $objParentClass->DisplayName;
         $objParentClass = $objParentClass->ParentQcodoClass;
     }
     $this->strParentClassArray = array_reverse($this->strParentClassArray, true);
     foreach ($this->objQcodoClass->GetChildQcodoClassArray(QQ::Clause(QQ::OrderBy(QQN::QcodoClass()->Name))) as $objChildClass) {
         $this->strChildClassArray[$objChildClass->Id] = $objChildClass->DisplayName;
     }
     if (QApplication::$Login) {
         $this->strEditLink = '<div class="edit_link" title="Edit" onclick="document.location=\'/edit_class.php/';
         $this->strEditLink .= $this->objQcodoClass->Id;
         $this->strEditLink .= '\'">EDIT</div>';
     }
 }
Пример #2
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'DisplayHtml':
             return QWriteBox::DisplayHtml($this->strText, $this->strCodeCssClass);
         case 'CodeCssClass':
             return $this->strCodeCssClass;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 return $objExc;
             }
     }
 }
Пример #3
0
 public function __construct($objClassOrOperation, $objParentControl, $strControlId = null)
 {
     parent::__construct($objParentControl, $strControlId);
     if ($objClassOrOperation instanceof Operation) {
         // We're Looking at a SINGLE Operations
         $this->objOperation = $objClassOrOperation;
         $this->objQcodoClass = $this->objOperation->QcodoClass;
         $this->strUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php/' . $this->objQcodoClass->Name . '/Methods/' . $this->objOperation->Name;
         $this->strTemplate = 'MethodPanelForOperation.tpl.php';
         $this->strShortDescriptionHtml = $this->objOperation->ShortDescriptionAsHtml;
         if (!$this->strShortDescriptionHtml) {
             $this->strShortDescriptionHtml = '<span style="color: #888888;"><i>No description entered yet.</i></span>';
         }
         $this->strLongDescriptionHtml = QWriteBox::DisplayHtml($this->objOperation->ExtendedDescription, 'writebox_code');
         $this->strVersion = 'Qcodo >= ' . $this->objOperation->FirstVersion;
         if ($this->objOperation->LastVersion) {
             $this->strVersion .= ' - Deprecated as of ' . $this->objOperation->LastVersion;
         }
         if ($this->objOperation->AbstractFlag) {
             $this->strMethodType = 'Abstract Instance Method';
         } else {
             if ($this->objOperation->StaticFlag) {
                 $this->strMethodType = 'Static Class Method';
             } else {
                 $this->strMethodType = 'Defined Instance Method';
             }
         }
         $strParameterArray = array();
         foreach ($this->objOperation->Parameters as $objParameter) {
             $strParameter = '<span style="color: #888888;">' . $objParameter->Variable->VariableType . '</span>';
             $strParameter .= '&nbsp;<b>';
             if ($objParameter->ReferenceFlag) {
                 $strParameter .= '&amp;';
             }
             $strParameter .= '$' . $objParameter->Variable->Name . '</b>';
             $strParameter .= '<span style="color: #888888;">' . $objParameter->Variable->DisplayDefaultValue . '</span>';
             array_push($strParameterArray, $strParameter);
         }
         $this->strPrototype = '';
         if ($this->objOperation->AbstractFlag) {
             $this->strPrototype .= 'abstract ';
         }
         if ($this->objOperation->StaticFlag) {
             $this->strPrototype .= 'static ';
         }
         if ($this->objOperation->FinalFlag) {
             $this->strPrototype .= 'final ';
         }
         $this->strPrototype .= strtolower(ProtectionType::ToString($this->objOperation->ProtectionTypeId)) . ' ';
         $this->strPrototype .= $this->objOperation->ReturnVariableId ? $this->objOperation->ReturnVariable->VariableType : 'void';
         $this->strPrototype .= ' <b>' . $this->objOperation->Name . '</b> ( ';
         $this->strPrototype .= implode(', ', $strParameterArray);
         if ($this->objOperation->AdditionalVariable) {
             if (count($strParameterArray)) {
                 $this->strPrototype .= ' [,&nbsp;';
             } else {
                 $this->strPrototype .= ' [';
             }
             $this->strPrototype .= '<span style="color: #888888;">' . $this->objOperation->AdditionalVariable->VariableType . '</span>&nbsp;<b>additional</b>&nbsp;[,&nbsp;<span style="color: #888888;">' . $this->objOperation->AdditionalVariable->VariableType . '</span>&nbsp;<b>...</b>]]';
         }
         $this->strPrototype .= ' )';
         if (QApplication::$Login) {
             $this->strEditLink = '<div class="edit_link" title="Edit" onclick="document.location=\'/edit_operation.php/';
             $this->strEditLink .= $this->objOperation->Id;
             $this->strEditLink .= '\'">EDIT</div>';
         }
         if ($objOverrides = $this->objOperation->Overrides) {
             $this->strOverrides = 'Overrides: <b>' . $this->objForm->RenderLink($objOverrides->QcodoClass->Name, null, $objOverrides->QcodoClassId, 'm') . '</b><br/>';
             $this->strOverridesIcon = ' &nbsp;<img src="/images/overrides.png" alt="Overrides"/>';
         }
     } else {
         // We're looking at ALL Methods/Operations
         $this->objQcodoClass = $objClassOrOperation;
         $this->strUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php/' . $this->objQcodoClass->Name . '/Methods';
         $this->strTemplate = 'MethodPanel.tpl.php';
         //				$objOperationArray = $this->objQcodoClass->GetOperationArray(QQ::Clause(QQ::OrderBy(QQN::Operation()->Name)));
         $objOperationArray = $this->objQcodoClass->Operations;
         foreach ($objOperationArray as $objOperation) {
             if ($objOperation->StaticFlag) {
                 array_push($this->objStaticOperationArray, $objOperation);
             } else {
                 if ($objOperation->AbstractFlag) {
                     array_push($this->objAbstractOperationArray, $objOperation);
                 } else {
                     array_push($this->objOperationArray, $objOperation);
                 }
             }
         }
     }
 }