当前位置: 首页>>代码示例>>PHP>>正文


PHP Option::getByValue方法代码示例

本文整理汇总了PHP中Option::getByValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::getByValue方法的具体用法?PHP Option::getByValue怎么用?PHP Option::getByValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Option的用法示例。


在下文中一共展示了Option::getByValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setStatus

 function setStatus($status)
 {
     $status = trim($status);
     $key = Option::getByValue($status, $this->getOptions('status'));
     if ($key !== FALSE) {
         $status = $key;
     }
     if ($this->Validator->inArrayKey('status', $status, TTi18n::gettext('Incorrect Status'), $this->getOptions('status'))) {
         $this->data['status_id'] = $status;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:13,代码来源:CronJobFactory.class.php

示例2: setAction

 function setAction($action)
 {
     $action = trim($action);
     $key = Option::getByValue($action, $this->getOptions('action'));
     if ($key !== FALSE) {
         $action = $key;
     }
     if ($this->Validator->inArrayKey('action', $action, TTi18n::gettext('Incorrect Action'), $this->getOptions('action'))) {
         $this->data['action_id'] = $action;
         return FALSE;
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:13,代码来源:LogFactory.class.php

示例3: setType

 function setType($type)
 {
     $type = trim($type);
     $key = Option::getByValue($type, $this->getOptions('type'));
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('type', $type, TTi18n::gettext('Incorrect Type'), $this->getOptions('type'))) {
         $this->data['type_id'] = $type;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:13,代码来源:UserIdentificationFactory.class.php

示例4: setDefaultScheduleStatus

 function setDefaultScheduleStatus($value)
 {
     $value = trim($value);
     $sf = new ScheduleFactory();
     $key = Option::getByValue($value, $sf->getOptions('status'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('default_schedule_status', $value, TTi18n::gettext('Incorrect Default Schedule Status'), $sf->getOptions('status'))) {
         $this->data['default_schedule_status_id'] = $value;
         return FALSE;
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:14,代码来源:HolidayPolicyFactory.class.php

示例5: getByCompanyIDAndUserIdAndStatusAndStartDateAndEndDate

    function getByCompanyIDAndUserIdAndStatusAndStartDateAndEndDate($company_id, $user_id, $status, $start_date, $end_date)
    {
        if ($company_id == '') {
            return FALSE;
        }
        if ($user_id == '') {
            return FALSE;
        }
        if ($start_date == '') {
            return FALSE;
        }
        if ($end_date == '') {
            return FALSE;
        }
        if ($status == '') {
            return FALSE;
        }
        $key = Option::getByValue($status, $this->getOptions('status'));
        if ($key !== FALSE) {
            $status = $key;
        }
        $uf = new UserFactory();
        $udf = new UserDateFactory();
        $otpf = new OverTimePolicyFactory();
        $ph = array('company_id' => $company_id, 'user_id' => $user_id, 'status_id' => $status, 'start_date' => $this->db->BindDate($start_date), 'end_date' => $this->db->BindDate($end_date));
        //Order by a.over_time_policy last so we never leave the ordering up to the database. This can cause
        //the unit tests to fail between databases.
        //AND a.type_id != 40
        $query = '
					select 	a.*,
							b.date_stamp as user_date_stamp
					from	' . $this->getTable() . ' as a
					LEFT JOIN ' . $udf->getTable() . ' as b ON a.user_date_id = b.id
					LEFT JOIN ' . $uf->getTable() . ' as c ON b.user_id = c.id
					LEFT JOIN ' . $otpf->getTable() . ' as d ON a.over_time_policy_id = d.id
					where
						c.company_id = ?
						AND	b.user_id = ?
						AND a.status_id = ?
						AND a.type_id not in (40,100,110)
						AND b.date_stamp >= ?
						AND b.date_stamp <= ?
						AND ( a.deleted = 0 AND b.deleted = 0 )
					ORDER BY b.date_stamp asc, a.status_id asc, a.type_id asc, d.type_id desc, a.over_time_policy_id desc, a.premium_policy_id, a.total_time, a.id
					';
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
开发者ID:alachaum,项目名称:timetrex,代码行数:48,代码来源:UserDateTotalListFactory.class.php

示例6: setProductEdition

 function setProductEdition($val)
 {
     $val = trim($val);
     $key = Option::getByValue($val, $this->getOptions('product_edition'));
     if ($key !== FALSE) {
         $val = $key;
     }
     if ($this->Validator->inArrayKey('product_edition', $val, TTi18n::gettext('Incorrect Product Edition'), $this->getOptions('product_edition'))) {
         $this->data['product_edition_id'] = $val;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:13,代码来源:CompanyFactory.class.php

示例7: getByStatus

    function getByStatus($status, $where = NULL, $order = NULL)
    {
        $key = Option::getByValue($status, $this->getOptions('status'));
        if ($key !== FALSE) {
            $status = $key;
        }
        if ($status == '') {
            return FALSE;
        }
        $ph = array('status_id' => $status);
        $query = '
					select 	*
					from	' . $this->getTable() . '

					where	status_id = ?
						AND deleted=0';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order);
        $this->rs = $this->db->Execute($query, $ph);
        return $this;
    }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:21,代码来源:PayPeriodListFactory.class.php

示例8: getByUserIdAndFolder

    function getByUserIdAndFolder($user_id, $folder, $limit = NULL, $page = NULL, $where = NULL, $order = NULL)
    {
        if ($user_id == '') {
            return FALSE;
        }
        $strict = TRUE;
        if ($order == NULL) {
            $strict = FALSE;
            $order = array('a.status_id' => '= 10 desc', 'a.created_date' => 'desc');
        }
        //Folder is: INBOX, SENT
        $key = Option::getByValue($folder, $this->getOptions('folder'));
        if ($key !== FALSE) {
            $folder = $key;
        }
        $rf = new RequestFactory();
        $uf = new UserFactory();
        $udf = new UserDateFactory();
        $pptsvf = new PayPeriodTimeSheetVerifyFactory();
        $ph = array('user_id' => $user_id);
        $folder_sent_query = NULL;
        $folder_inbox_query = NULL;
        $folder_inbox_query_a = NULL;
        $folder_inbox_query_ab = NULL;
        $folder_inbox_query_b = NULL;
        $folder_inbox_query_c = NULL;
        if ($folder == 10) {
            $ph['id'] = $user_id;
            $ph['created_by1'] = $user_id;
            $ph['created_by2'] = $user_id;
            $ph['created_by3'] = $user_id;
            $ph['created_by4'] = $user_id;
            $folder_inbox_query = ' AND a.created_by != ?';
            $folder_inbox_query_a = ' OR d.id = ?';
            $folder_inbox_query_ab = ' OR e.user_id = ?';
            //$folder_inbox_query_b = ' OR a.parent_id in ( select parent_id FROM '. $this->getTable() .' WHERE created_by = '. $user_id .' ) ';
            $folder_inbox_query_b = ' OR a.parent_id in ( select parent_id FROM ' . $this->getTable() . ' WHERE created_by = ? AND parent_id != 0 ) ';
            $folder_inbox_query_c = ' OR a.parent_id in ( select id FROM ' . $this->getTable() . ' WHERE created_by = ? AND parent_id = 0 ) ';
        } elseif ($folder == 20) {
            $ph['created_by4'] = $user_id;
            $folder_sent_query = ' OR a.created_by = ?';
        }
        //Need to include all threads that user has posted to.
        $query = '
					SELECT a.*,
							CASE WHEN a.object_type_id = 5 THEN d.id WHEN a.object_type_id = 50 THEN c.user_id WHEN a.object_type_id = 90 THEN e.user_id END as sent_to_user_id
					FROM ' . $this->getTable() . ' as a
						LEFT JOIN ' . $uf->getTable() . ' as d ON a.object_type_id = 5 AND a.object_id = d.id
						LEFT JOIN ' . $uf->getTable() . ' as f ON a.created_by = f.id
						LEFT JOIN ' . $rf->getTable() . ' as b ON a.object_type_id = 50 AND a.object_id = b.id
						LEFT JOIN ' . $udf->getTable() . ' as c ON b.user_date_id = c.id
						LEFT JOIN ' . $pptsvf->getTable() . ' as e ON a.object_type_id = 90 AND a.object_id = e.id
					WHERE
							a.object_type_id in (5,50,90)
							AND
							(

								(
									(
										c.user_id = ?
										' . $folder_sent_query . '
										' . $folder_inbox_query_a . '
										' . $folder_inbox_query_ab . '
										' . $folder_inbox_query_b . '
										' . $folder_inbox_query_c . '
									)
									' . $folder_inbox_query . '
								)
							)

						AND ( a.deleted = 0 AND f.deleted = 0
								AND ( b.id IS NULL OR ( b.id IS NOT NULL AND b.deleted = 0 ) )
								AND ( c.id IS NULL OR ( c.id IS NOT NULL AND c.deleted = 0 ) )
								AND ( d.id IS NULL OR ( d.id IS NOT NULL AND d.deleted = 0 ) )
								AND ( e.id IS NULL OR ( e.id IS NOT NULL AND e.deleted = 0 ) )
								AND NOT ( b.id IS NULL AND c.id IS NULL AND d.id IS NULL AND e.id IS NULL )
							)
					';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order, $strict, array('sent_to_user_id'));
        //Debug::text('Query: '. $query , __FILE__, __LINE__, __METHOD__,9);
        if ($limit == NULL) {
            //Run query without limit
            $this->rs = $this->db->Execute($query, $ph);
        } else {
            $this->rs = $this->db->PageExecute($query, $limit, $page, $ph);
        }
        return $this;
    }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:89,代码来源:MessageListFactory.class.php

示例9: setType

 function setType($type)
 {
     $type = trim($type);
     //$jif = new JobItemFactory();
     $key = Option::getByValue($type, $this->getOptions('type'));
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('type', $type, TTi18n::gettext('Incorrect Type'), $this->getOptions('type')) and $this->Validator->isTrue('type', $this->isUniqueType($type), TTi18n::gettext('Type already exists'))) {
         $this->data['type_id'] = $type;
         return FALSE;
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:14,代码来源:OtherFieldFactory.class.php

示例10: setAction

 function setAction($action)
 {
     $action = trim($action);
     //Use integer ID values instead.
     $key = Option::getByValue($action, $this->getOptions('action'));
     if ($key !== FALSE) {
         Debug::text('Text Action: ' . $action . ' Key: ' . $key, __FILE__, __LINE__, __METHOD__, 10);
         $action = $key;
     }
     if ($this->Validator->inArrayKey('action', $action, TTi18n::gettext('Incorrect Action'), $this->getOptions('action'))) {
         $this->data['action_id'] = $action;
         return FALSE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:15,代码来源:LogFactory.class.php

示例11: setObjectType

 function setObjectType($type)
 {
     $type = trim($type);
     // i18n: passing 3rd param as false because object_type options do not use gettext
     $key = Option::getByValue($type, $this->getOptions('object_type'), false);
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('object_type', $type, TTi18n::gettext('Object Type is invalid'), $this->getOptions('object_type'))) {
         $this->data['object_type_id'] = $type;
         return FALSE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:14,代码来源:AuthorizationFactory.class.php

示例12: setStatus

 function setStatus($status)
 {
     $status = trim($status);
     $key = Option::getByValue($status, $this->getOptions('status'));
     if ($key !== FALSE) {
         $status = $key;
     }
     if ($this->Validator->inArrayKey('status', $status, TTi18n::gettext('Incorrect Status'), $this->getOptions('status'))) {
         $this->data['status_id'] = $status;
         Debug::Text('Setting status_id data...    ' . $this->data['status_id'], __FILE__, __LINE__, __METHOD__, 10);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:14,代码来源:KPIFactory.class.php

示例13: setSeverity

 function setSeverity($value)
 {
     $value = trim($value);
     $key = Option::getByValue($value, $this->getOptions('severity'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('severity', $value, TTi18n::gettext('Incorrect Severity'), $this->getOptions('severity'))) {
         $this->data['severity_id'] = $value;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:13,代码来源:ExceptionPolicyFactory.class.php

示例14: setLengthOfServiceUnit

 function setLengthOfServiceUnit($value)
 {
     $value = trim($value);
     $key = Option::getByValue($value, $this->getOptions('length_of_service_unit'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('length_of_service_unit_id' . $this->getLabelID(), $value, TTi18n::gettext('Incorrect Length of service unit'), $this->getOptions('length_of_service_unit'))) {
         $this->data['length_of_service_unit_id'] = $value;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:13,代码来源:AccrualPolicyMilestoneFactory.class.php

示例15: setStatus

 function setStatus($status)
 {
     $status = trim($status);
     $key = Option::getByValue($status, $this->getOptions('status'));
     if ($key !== FALSE) {
         $status = $key;
     }
     $modify_status = FALSE;
     if ($this->getCurrentUserPermissionLevel() >= $this->getPermissionLevel()) {
         $modify_status = TRUE;
     } elseif ($this->getStatus() == $status) {
         //No modification made.
         $modify_status = TRUE;
     }
     if ($this->Validator->inArrayKey('status_id', $status, TTi18n::gettext('Incorrect Status'), $this->getOptions('status')) and $this->Validator->isTrue('status_id', $modify_status, TTi18n::gettext('Insufficient access to modify status for this employee'))) {
         $this->data['status_id'] = $status;
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:20,代码来源:UserFactory.class.php


注:本文中的Option::getByValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。