Пример #1
0
 function checkIfEnoughParentQuota($parent)
 {
     $class = $this->get__table();
     $numvar = $class . "_num";
     if (isQuotaGreaterThan($parent->used->{$numvar} + 1, $parent->priv->{$numvar})) {
         throw new lxexception('not_enough_quota_in_parent', $k);
     }
     $qlist = $this->getQuotaVariableList();
     foreach ($qlist as $k => $q) {
         if (isQuotaGreaterThan($this->priv->{$k}, $parent->priv->{$k})) {
             throw new lxexception('not_enough_quota_in_parent', $k);
         }
         if (isQuotaGreaterThan($parent->used->{$k} + $this->used->{$k}, $parent->priv->{$k})) {
             throw new lxexception('not_enough_quota_in_parent', $k);
         }
     }
     return true;
 }
Пример #2
0
 function checkTemplateGreaterThan($tmp)
 {
     $pvlist = $this->getQuotaVariableList();
     foreach ($pvlist as $k => $var) {
         if (!isset($tmp->priv->{$k})) {
             continue;
         }
         if (isQuotaGreaterThan($tmp->priv->{$k}, $this->priv->{$k})) {
             return $k;
         }
     }
     return false;
 }
Пример #3
0
function __ac_desc_continue($object)
{
    global $gbl, $sgbl, $login, $ghtml;
    $cname = $ghtml->frm_o_cname;
    $numvar = $cname . "_num";
    if ($object->isQuotaVariable($numvar)) {
        if (isQuotaGreaterThan($object->used->{$numvar}, $object->priv->{$numvar})) {
            throw new lxException("Quota Exceeded for {$cname}", $numvar);
        }
    }
    $param = $ghtml->createCurrentParam($cname);
    $continueaction = $ghtml->frm_continueaction;
    $ret = exec_class_method($cname, 'continueForm', $object, $cname, $param, $continueaction);
    if ($ret['action'] === 'addnow') {
        __ac_desc_add($object, $ret['param']);
        return;
    }
    $alist = exec_class_method($cname, "createListAlist", $object, $cname);
    if ($alist) {
        $ghtml->print_tab_block($alist);
    }
    $ghtml->print_message();
    //dprintr($param);
    $string[] = $ghtml->object_variable_startblock($object, $cname, "Continue Add {$cname}");
    $string[] = $ghtml->object_inherit_classpath();
    $string[] = $ghtml->object_variable_hidden("frm_o_cname", $cname);
    $tparam = $ret['param'];
    $vlist = $ret['variable'];
    if (isset($tparam['nname']) && exists_in_db($object->__masterserver, $cname, $tparam['nname'])) {
        throw new lxException("{$tparam['nname']}+already+exists+in+{$cname}.", "nname");
    }
    $param = null;
    foreach ($tparam as $k => $v) {
        $param["frm_" . $cname . "_c_" . $k] = $v;
    }
    $string[] = $ghtml->object_variable_hiddenlist($param);
    $string[] = create_xml($object, $cname, $ret);
    $pre = $post = null;
    if (isset($vlist['__m_message_pre'])) {
        $pre = $vlist['__m_message_pre'];
    }
    if (isset($vlist['__m_message_post'])) {
        $post = $vlist['__m_message_post'];
    }
    $ghtml->print_information('pre', 'continueform', "", $continueaction, $pre);
    $ghtml->xml_print_page($string);
    $ghtml->print_information('post', 'continueform', "", $continueaction, $post);
}