18 use \Dcp\AttributeIdentifiers\Cvdoc as MyAttributes;
51 if (isset($this->fromid)) $this->defProfFamId =
$this->fromid;
60 $err = parent::preConsultation();
66 foreach ($menus as $k => $menuId) {
71 if ($menuLabel && $menuLabel !== $menuId) {
72 $this->
setValue(MyAttributes::cv_menu, sprintf(
"%s (%s)", $menuId, $menuLabel) , $k);
76 if ($vLabel[$k] && $vLabel[$k] !== $label) {
77 $this->
setValue(MyAttributes::cv_lview, sprintf(
"%s (%s)", $vLabel[$k], $label) , $k);
86 $err = parent::preEdition();
94 $action->parent->addCssRef(
"FDL/Layout/cvdoc_array_view.css");
103 $this->extendedAcls = array();
108 foreach ($tk as $k => $v) {
109 if ($ti[$k] ==
"") $cvk =
"CV$k";
111 $this->extendedAcls[$cvk] = array(
113 "description" => $tl[$k]
116 $this->acls[$cvk] = $cvk;
122 if (
'' !== $idCreationView) {
123 $viewIds = $this->getAttributeValue(MyAttributes::cv_idview);
124 $viewLabels = $this->getAttributeValue(MyAttributes::cv_lview);
125 $viewIndex = array_search($idCreationView, $viewIds);
126 if (
false !== $viewIndex) {
127 return sprintf(
"%s (%s)", $viewLabels[$viewIndex], $idCreationView);
142 $dc = new \DocCtrl($this->dbaccess);
143 $originals = $dc->dacls;
145 if (!preg_match(
'!^[0-9a-z_-]+$!i',
$value)) {
146 $err = sprintf(_(
"You must use only a-z, 0-9, _, - characters : \"%s\"") ,
$value);
147 } elseif (array_key_exists(
$value, $originals)) {
148 $err = _(
"Impossible to name a view like a control acl");
152 foreach ($id_list as
$id) {
158 $err = _(
"Impossible to have several identical names");
171 if (strlen(trim(
$value)) == 0) {
172 $err = _(
"Label must not be empty");
183 if (
'' !== $idCreationView) {
184 if (!is_array($idViews) || !in_array($idCreationView, $idViews)) {
185 $err = sprintf(
___(
"creation view '%s' does not exists",
"CVDOC") , $labelCreationView);
198 foreach ($tv as $v) {
199 if ($v[
"cv_idview"] === $vid) {
201 foreach ($v as $k => $av) {
202 $v[strtoupper($k) ] = $av;
221 return isset($view[
"CV_LVIEW"]) ? $view[
"CV_LVIEW"] : sprintf(_(
"Unlabeled view (%s)") , $vid);
235 return isset($view[
"CV_MENU"]) ? $view[
"CV_MENU"] : sprintf(_(
"Unlabeled menu (%s)") , $vid);
242 foreach ($ti as $k => $v) {
254 $cud = ($this->doc->CanEdit() ==
"");
255 $displayableViews = array();
256 foreach ($tv as $v) {
257 $vid = $v[MyAttributes::cv_idview];
258 $mode = $v[MyAttributes::cv_kview];
259 if ($v[MyAttributes::cv_displayed] !==
"no") {
262 if ($this->
control($vid) ==
"") {
263 $displayableViews[] = $v;
268 if ($cud && $this->
control($vid) ==
"") {
269 $displayableViews[] = $v;
275 return $displayableViews;
287 foreach ($ti as $k => $v) {
288 if ($v ==
"") $ti[$k] =
"CV$k";
295 return \Doc::control($aclname,
$strict);
313 if ($this->pdoc === null) {
314 $pdoc =
createDoc($this->dbaccess, $this->fromid,
false);
315 $pdoc->doctype =
"T";
318 if (
$err !=
"")
return "CVDoc::Control:" .
$err;
321 $pdoc->setProfil($this->profid, $this->doc);
323 $this->pdoc = & $pdoc;
334 if (!isset($this->doc)) {
347 if ($edition && (!$this->doc->id)) {
351 $viewU = $this->
getView($vidcreate);
353 foreach ($viewU as $k => $v) $view[strtolower($k) ] = $v;
358 $type = ($edition) ?
"VEDIT" :
"VCONS";
362 usort($tv,
"cmp_cvorder3");
363 foreach ($tv as $k => $v) {
364 if ($v[
"cv_order"] > 0) {
365 if ($v[
"cv_kview"] ==
$type) {
preImport(array $extra=array())
computeCreationViewLabel($idCreationView)
verifyAllConstraints($stoptofirst=true, &$info=array())
postAffect(array $data, $more, $reset)
__construct($dbaccess= '', $id= '', $res= '', $dbid=0)
if(!function_exists('pgettext')) ___($message, $context="")
getArrayRawValues($idAttr, $index=-1)
__construct($dbaccess= '', $id= '', $res= '', $dbid=0)
docControl($aclname, $strict=false)
setValue($attrid, $value, $index=-1, &$kvalue=null)
getMultipleRawValues($idAttr, $def="", $index=-1)
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getPrimaryView($edition=false)
isCreationViewValid($idCreationView, $labelCreationView, $idViews)
if($file) if($subject==""&&$file) if($subject=="") $err
control($aclname, $strict=false)
getRawValue($idAttr, $def="")