Standardize code
This commit is contained in:
parent
15fc8ce33b
commit
2668b80599
@ -57,3 +57,4 @@ ErrorInsertingComment=There was an error while inserting your comment
|
|||||||
MoreChoices=Enter more choices for the voters
|
MoreChoices=Enter more choices for the voters
|
||||||
SurveyExpiredInfo=The poll has been closed or voting delay has expired.
|
SurveyExpiredInfo=The poll has been closed or voting delay has expired.
|
||||||
EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s
|
EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s
|
||||||
|
ShowSurvey=Show survey
|
||||||
@ -37,7 +37,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
public $element='opensurvey_sondage'; //!< Id that identify managed objects
|
public $element='opensurvey_sondage'; //!< Id that identify managed objects
|
||||||
public $table_element='opensurvey_sondage'; //!< Name of table without prefix where object is stored
|
public $table_element='opensurvey_sondage'; //!< Name of table without prefix where object is stored
|
||||||
public $picto = 'opensurvey';
|
public $picto = 'opensurvey';
|
||||||
|
|
||||||
public $id_sondage;
|
public $id_sondage;
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -75,7 +75,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $allow_spy;
|
public $allow_spy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draft status (not used)
|
* Draft status (not used)
|
||||||
*/
|
*/
|
||||||
@ -88,9 +88,9 @@ class Opensurveysondage extends CommonObject
|
|||||||
* Closed
|
* Closed
|
||||||
*/
|
*/
|
||||||
const STATUS_CLOSED = 2;
|
const STATUS_CLOSED = 2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -110,7 +110,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, Id of created object if OK
|
* @return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger=0)
|
function create(User $user, $notrigger=0)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
* @param string $numsurvey Ref of survey (admin or not)
|
* @param string $numsurvey Ref of survey (admin or not)
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$numsurvey='')
|
function fetch($id, $numsurvey='')
|
||||||
{
|
{
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.id_sondage,";
|
$sql.= " t.id_sondage,";
|
||||||
@ -275,7 +275,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user, $notrigger=0)
|
function update(User $user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -348,7 +348,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
* @param string $numsondage Num sondage admin to delete
|
* @param string $numsondage Num sondage admin to delete
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger, $numsondage)
|
function delete(User $user, $notrigger, $numsondage)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -402,6 +402,63 @@ class Opensurveysondage extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a link to the object card (with optionaly the picto)
|
||||||
|
*
|
||||||
|
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
|
* @param string $morecss Add more css on link
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
|
* @return string String with URL
|
||||||
|
*/
|
||||||
|
function getNomUrl($withpicto=0, $notooltip=0, $morecss='', $save_lastsearch_value=-1)
|
||||||
|
{
|
||||||
|
global $db, $conf, $langs;
|
||||||
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
|
global $menumanager;
|
||||||
|
|
||||||
|
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
$companylink = '';
|
||||||
|
|
||||||
|
$label = '<u>' . $langs->trans("ShowSurvey") . '</u>';
|
||||||
|
$label.= '<br>';
|
||||||
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref.'<br>';
|
||||||
|
$label.= '<b>' . $langs->trans('Title') . ':</b> ' . $this->title.'<br>';
|
||||||
|
|
||||||
|
$url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id;
|
||||||
|
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
|
||||||
|
$linkclose='';
|
||||||
|
if (empty($notooltip))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
|
{
|
||||||
|
$label=$langs->trans("ShowMyObject");
|
||||||
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
}
|
||||||
|
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||||
|
}
|
||||||
|
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||||
|
|
||||||
|
$linkstart = '<a href="'.$url.'"';
|
||||||
|
$linkstart.=$linkclose.'>';
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
|
$result .= $linkstart;
|
||||||
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
|
if ($withpicto != 2) $result.= $this->ref;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return array of lines
|
* Return array of lines
|
||||||
*
|
*
|
||||||
@ -544,8 +601,8 @@ class Opensurveysondage extends CommonObject
|
|||||||
$this->allow_spy = ($this->allow_spy ? 1 : 0);
|
$this->allow_spy = ($this->allow_spy ? 1 : 0);
|
||||||
$this->sujet = trim($this->sujet);
|
$this->sujet = trim($this->sujet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return status label of Order
|
* Return status label of Order
|
||||||
*
|
*
|
||||||
@ -556,7 +613,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
{
|
{
|
||||||
return $this->LibStatut($this->status,$mode);
|
return $this->LibStatut($this->status,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return label of status
|
* Return label of status
|
||||||
*
|
*
|
||||||
@ -567,7 +624,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
function LibStatut($status,$mode)
|
function LibStatut($status,$mode)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
//print 'x'.$status.'-'.$billed;
|
//print 'x'.$status.'-'.$billed;
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
@ -606,5 +663,5 @@ class Opensurveysondage extends CommonObject
|
|||||||
if ($status==self::STATUS_CLOSED) return '<span class="hideonsmartphone">'.$langs->trans('Closed').' </span>'.img_picto($langs->trans('Closed'),'statut6');
|
if ($status==self::STATUS_CLOSED) return '<span class="hideonsmartphone">'.$langs->trans('Closed').' </span>'.img_picto($langs->trans('Closed'),'statut6');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,12 +171,19 @@ while ($i < min($num,$limit))
|
|||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
|
|
||||||
$opensurvey_static->id=$obj->id_sondage;
|
$opensurvey_static->id=$obj->id_sondage;
|
||||||
|
$opensurvey_static->ref=$obj->id_sondage;
|
||||||
|
$opensurvey_static->title=$obj->titre;
|
||||||
$opensurvey_static->status=$obj->status;
|
$opensurvey_static->status=$obj->status;
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?id='.$obj->id_sondage.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
|
print $opensurvey_static->getNomUrl(1);
|
||||||
print '</td><td>'.dol_htmlentities($obj->titre).'</td><td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Title
|
||||||
|
print '<td>'.dol_htmlentities($obj->titre).'</td><td>';
|
||||||
$type=($obj->format=='A')?'classic':'date';
|
$type=($obj->format=='A')?'classic':'date';
|
||||||
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
||||||
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate");
|
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate");
|
||||||
@ -200,7 +207,7 @@ while ($i < min($num,$limit))
|
|||||||
print'<td align="right">'.$nbuser.'</td>'."\n";
|
print'<td align="right">'.$nbuser.'</td>'."\n";
|
||||||
|
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_fin),'day');
|
print '<td align="center">'.dol_print_date($db->jdate($obj->date_fin),'day');
|
||||||
if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; }
|
if ($db->jdate($obj->date_fin) < time()) { print img_warning($langs->trans("Expired")); }
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
|
print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
|
||||||
|
|||||||
@ -936,20 +936,21 @@ class Dolresource extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowResource").': '.$this->ref;
|
$label=$langs->trans("ShowResource").': '.$this->ref;
|
||||||
|
|
||||||
|
$linkstart = '';
|
||||||
|
$linkend = '';
|
||||||
if ($option == '')
|
if ($option == '')
|
||||||
{
|
{
|
||||||
$link = '<a href="'.dol_buildpath('/resource/card.php',1).'?id='.$this->id. $get_params .'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.dol_buildpath('/resource/card.php',1).'?id='.$this->id. $get_params .'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$picto='resource';
|
$picto='resource';
|
||||||
$label=$langs->trans("ShowResource").': '.$this->ref;
|
$label=$langs->trans("ShowResource").': '.$this->ref;
|
||||||
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkend='</a>';
|
$result .= $linkstart;
|
||||||
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
|
if ($withpicto != 2) $result.= $this->ref;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
|
||||||
$result.=$link.$this->ref.$linkend;
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user